It didn'tthrow any exception, but it seem when i run the application, it
hang there..
and no response... whole PPC hang and have to reset..
I tried P/Invoke anotehr more simple function :
DLL : long GetDLLVersion(void);
in c#
[DllImport("//Program Files//TestMobile//CFReader.dll",
EntryPoint="GetDLLVersion", CharSet=CharSet.Auto)]
public static extern int GetDLLVersion();
when it run, my Pocket PC caption bar suddenly changed to "Pocket PC
Networking"
and then hang there, is it the CFReader.dll got problem ? or i still
code the wrong way ??
Please point me.. thanks...
Best regards,
Bsiang.
Here are the result I use dumpbin which you taught me :
1 6E 00001C60 CloseComm
2 6F 00001C10 CloseReader
3 70 00001CD8 DetectReader
4 71 00001F20 DetectSerialPort
5 72 00002A04 EmptyCommRcvBuffer
6 73 00002EE4 GetBroadcast
7 74 00002968 GetCommBaudRate
8 75 00002AE4 GetCommContRcv
9 76 0000294C GetCommProtocol
10 77 00002B5C GetCommTimeout
11 78 00002F10 GetDLLVersion
.................
..........
I will try
[DllImport("CFReader.dll", EntryPoint="DetectSerialPort")]
IntPtr DetectSerialPort(byte[] buffer);
and report to you here
thanks again...
Best regards,
Bsiang.
It really depends on how this is used, but I'd probably use this:
[DllImport("CFReader.dll", EntryPoint="DetectSerialPort")]
IntPtr DetectSerialPort(byte[] buffer);
As I asked before though, is the function exported, and is it
non-decorated?
--
Chris Tacke
Co-founder
OpenNETCF.org
Has OpenNETCF helped you? Consider donating to support us!
http://www.opennetcf.org/donate
Thanks Chris !!!
Really thanks..
I change to :
char* DetectSerialPort(char* buffer);
In my C# code :
[DllImport("CFReader.dll", EntryPoint="DetectSerialPort")]
byte[] DetectSerialPort(byte[] buffer);
But now I get NotSupportedException, would you help point me out
again ?
Thanks...
Best regards,
Bsiang.
char * != String, it's a byte[]
second, is the function publicly exported? Use depends or dumpbin
to find out
--
Chris Tacke
Co-founder
OpenNETCF.org
Has OpenNETCF helped you? Consider donating to support us!
http://www.opennetcf.org/donate
That one is just a test, coz I fail to try on my original DLL,
which connect to a RFID reader.
Thus, i create this MessageBox( ) as test.
I am new in .NET CF,
what I am doing, is trying connect to a RFID reader, given a
unmanaged DLL.
Could any help me ?
Please......
Here is the link of the DLL :
And link for the description of the DLL :
For eg :
char* DetectSerialPort(char* buffer);
In my C# code :
[DllImport("CFReader.dll", EntryPoint="DetectSerialPort")]
String DetectSerialPort(String buffer);
but when I run it, I will get MissingMethodException
Could you point me out ?
Thanks a lot !
Best regards,
Bsiang.
Dear all,
I am trying on P/Invoke. Here is my simple unit test code :
[DllImport("User32.dll", EntryPoint="MessageBox",
CharSet=CharSet.Auto)]public static extern int MsgBox(int hWnd,
String text, String caption, uint type);
when I call :
Msg(0, "hi", "Hi", 0); --> It raise MissingMethodException
I had copy user32.dll into my PPC Windows folder.
Please help me... Pls...
Best regards,
Bsiang.