Re: ask about CeRapiInvoke in C#
- From: "sophia" <lhxsky@xxxxxxx>
- Date: Thu, 2 Aug 2007 10:25:36 +0800
Thank you very much Prter, I am not that familiar with C# ,so my code is not
that logical.Now it has been resolved,the problem rests with the rapi.dll
which is invalid and CeRapiInitEx failed when calling.
Sophia
"Peter Foot [MVP]" <feedback@xxxxxxxxxxxxxxxxxxxx>
??????:D94BC580-C154-4B4A-B907-B290DF9DA570@xxxxxxxxxxxxxxxx
Why are you converting your strings to bytes and back again. Since your
declaration specifies the Unicode charset that is how they will be
marshalled. Also you'll find it easier to pass pcbOutput as out uint
(rather than IntPtr) since this represents the size of ppOutput.
Peter
--
Peter Foot
Microsoft Device Application Development MVP
www.peterfoot.net | www.inthehand.com
In The Hand Ltd - .NET Solutions for Mobility
"sophia" <lhxsky@xxxxxxx> wrote in message
news:ezEN7hB1HHA.4236@xxxxxxxxxxxxxxxxxxxxxxx
Another point to say is,the self defined dll on wince device works well
when calling in c++,but in c# there is problem.Can you give me some
advice about this ,thank you in advance.
"sophia" <lhxsky@xxxxxxx>
дÈëÏûÏ¢ÐÂÎÅ:O1KIwZB1HHA.536@xxxxxxxxxxxxxxxxxxxxxxx
Hello everyone,
Now I call CeRapiInvoke in C#,but the return value is -2147014795
anyway,can any one give me some clue,thank you in advance. the code
snippet as following:
DllImport("rapi.dll",EntryPoint = "CeRapiInvoke",CharSet =
CharSet.Unicode, CallingConvention = allingConvention.StdCall)]
public static extern Int32 CeRapiInvoke( string pDllPath,
string pFunctionName,
uint cbInput,
byte[] pInput,
out IntPtr pcbOutput,
out IntPtr ppOutput,
IntPtr ppIRAPIStream,//NULL
uint dwReserved
);
uint cbInput = sizeof(byteInputArr);//byteInputArr is byte array defined
before
IntPtr cbOut = IntPtr.Zero;
IntPtr szOut = IntPtr.Zero;
Byte[]input=new Byte[cbInput];//allocate new space to transfer data to
ce
Array.Copy(byteInputArr, 0, input, 0, cbInput);
string path ="mydll.dll";//dll on wince device
string rfname = "rfn";//name of function to call
string upath =
System.Text.Encoding.Unicode.GetString(System.Text.Encoding.Default.GetBytes(path));
string urfname =
System.Text.Encoding.Unicode.GetString(System.Text.Encoding.Default.GetBytes(wfname));
hr = CeRapiInvoke(upath,urfname,cbInput,input,out cbOut,out
szOut,(IntPtr)null,0);
.
- References:
- ask about CeRapiInvoke in C#
- From: sophia
- Re: ask about CeRapiInvoke in C#
- From: sophia
- Re: ask about CeRapiInvoke in C#
- From: Peter Foot [MVP]
- ask about CeRapiInvoke in C#
- Prev by Date: Re: CreateThread and lp
- Next by Date: SetCursor(LoadCursor(NULL, IDC_WAIT)) not working on a Toshiba G900 device
- Previous by thread: Re: ask about CeRapiInvoke in C#
- Next by thread: setup failed if add cesetup.dll to inf file
- Index(es):
Relevant Pages
|
Loading