[Urgent] Pls help me in P/Invoke unmanaged DLL

R

Rico

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.
 
D

Daniel Moth

Functions from user32.dll, kernel, advapi etc reside in coredll.dll on
WindowsCE so you need to change your declarations.

The specific one you are trying to accomplish you can do the managed way:
System.Windows.Forms.MessageBox.Show(...)

Cheers
Daniel
 
A

Alex Feinman [MVP]

<rolls eyes> What user32.dll? What do you mean "copy into PPC Windows
folder"? It's a desktop DLL.
on PPC MsgBox is in coredll.dll
 
B

Bsiang

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.
 
C

Chris Tacke, eMVP

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


Bsiang said:
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.


Rico said:
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.
 
B

Bsiang

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.




Chris Tacke said:
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


Bsiang said:
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.


Rico said:
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.
 
C

Chris Tacke, eMVP

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


Bsiang said:
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.




Chris Tacke said:
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


Bsiang said:
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.
 
B

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.

Chris Tacke said:
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


Bsiang said:
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.




Chris Tacke said:
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.
 
B

Bsiang

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.


Bsiang said:
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.

Chris Tacke said:
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


Bsiang said:
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.
 
A

Alex Feinman [MVP]

How big is the buffer the function expects? Your link to PDF file does not
open

--
Alex Feinman
---
Visit http://www.opennetcf.org
Bsiang said:
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.


Bsiang said:
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.

Chris Tacke said:
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.
 
B

Bsiang

Device Communication
DetectSerialPort
The DetectSerialPort function detects the serial port of a connected reader.

C++ char* DetectSerialPort(char* buffer);

Parameters
buffer A buffer of the return value.
The buffer size has the size of 256 bytes.

Return value
The serial port is returned as 0 terminated string.

Example of a detected serial port: "COM4:"

The handheld reader dll documentation is available below:
http://www.geocities.com/raymond_owf/RFPCHandheldReader_DLL.pdf

The reader manunfacturer url:
http://www.acg.de/synformation/serv...te/RFIDProducts/RFID_RfPcHandheldReader_Tools


Thank you!

Best Regards
Bsiang


Alex Feinman said:
How big is the buffer the function expects? Your link to PDF file does not
open

--
Alex Feinman
---
Visit http://www.opennetcf.org
Bsiang said:
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.


Bsiang said:
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.
 
A

Alex Feinman [MVP]

What happens if you invoke DetectSerialPort like this:
byte[] buffer = new byte[256];
DetectSerialPort(buffer);
string port = Encoding.ASCII.GetString(buffer, buffer.Length);


Also, post the information printed by
dumpbin /HEADER CFReader.dll

--
Alex Feinman
---
Visit http://www.opennetcf.org
Bsiang said:
Device Communication
DetectSerialPort
The DetectSerialPort function detects the serial port of a connected
reader.

C++ char* DetectSerialPort(char* buffer);

Parameters
buffer A buffer of the return value.
The buffer size has the size of 256 bytes.

Return value
The serial port is returned as 0 terminated string.

Example of a detected serial port: "COM4:"

The handheld reader dll documentation is available below:
http://www.geocities.com/raymond_owf/RFPCHandheldReader_DLL.pdf

The reader manunfacturer url:
http://www.acg.de/synformation/serv...te/RFIDProducts/RFID_RfPcHandheldReader_Tools


Thank you!

Best Regards
Bsiang


Alex Feinman said:
How big is the buffer the function expects? Your link to PDF file does
not open

--
Alex Feinman
---
Visit http://www.opennetcf.org
Bsiang said:
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.
 
B

Bsiang

Thank Alex.....
I am trying yur solution...
by the way, here is the DumpBin /Header

E:\Learn>dumpbin /headers cfreader.dll
Microsoft (R) COFF/PE Dumper Version 7.10.3077
Copyright (C) Microsoft Corporation. All rights reserved.


Dump of file cfreader.dll

PE signature found

File Type: DLL

FILE HEADER VALUES
1C0 machine (ARM)
6 number of sections
3F9FBC16 time date stamp Wed Oct 29 21:09:42 2003
0 file pointer to symbol table
0 number of symbols
E0 size of optional header
210E characteristics
Executable
Line numbers stripped
Symbols stripped
32 bit word machine
DLL

OPTIONAL HEADER VALUES
10B magic # (PE32)
6.24 linker version
1AE00 size of code
C800 size of initialized data
0 size of uninitialized data
8AB0 entry point (00108AB0)
1000 base of code
1C000 base of data
100000 image base (00100000 to 00129FFF)
1000 section alignment
200 file alignment
4.00 operating system version
0.00 image version
4.20 subsystem version
0 Win32 version
2A000 size of image
400 size of headers
0 checksum
9 subsystem (Windows CE GUI)
0 DLL characteristics
10000 size of stack reserve
1000 size of stack commit
100000 size of heap reserve
1000 size of heap commit
0 loader flags
10 number of directories
1EAC0 [ 1A6F] RVA [size] of Export Directory
1E734 [ 50] RVA [size] of Import Directory
26000 [ 428] RVA [size] of Resource Directory
24000 [ 1DA0] RVA [size] of Exception Directory
0 [ 0] RVA [size] of Certificates Directory
27000 [ 16F4] RVA [size] of Base Relocation Directory
0 [ 0] RVA [size] of Debug Directory
0 [ 0] RVA [size] of Architecture Directory
0 [ 0] RVA [size] of Global Pointer Directory
0 [ 0] RVA [size] of Thread Storage Directory
0 [ 0] RVA [size] of Load Configuration Directory
0 [ 0] RVA [size] of Bound Import Directory
21000 [ 2FC] RVA [size] of Import Address Table Directory
0 [ 0] RVA [size] of Delay Import Directory
0 [ 0] RVA [size] of COM Descriptor Directory
0 [ 0] RVA [size] of Reserved Directory


SECTION HEADER #1
.text name
1ADD8 virtual size
1000 virtual address (00101000 to 0011BDD7)
1AE00 size of raw data
400 file pointer to raw data (00000400 to 0001B1FF)
0 file pointer to relocation table
0 file pointer to line numbers
0 number of relocations
0 number of line numbers
60000020 flags
Code
Execute Read

SECTION HEADER #2
.rdata name
452F virtual size
1C000 virtual address (0011C000 to 0012052E)
4600 size of raw data
1B200 file pointer to raw data (0001B200 to 0001F7FF)
0 file pointer to relocation table
0 file pointer to line numbers
0 number of relocations
0 number of line numbers
40000040 flags
Initialized Data
Read Only

SECTION HEADER #3
.data name
2EF4 virtual size
21000 virtual address (00121000 to 00123EF3)
E00 size of raw data
1F800 file pointer to raw data (0001F800 to 000205FF)
0 file pointer to relocation table
0 file pointer to line numbers
0 number of relocations
0 number of line numbers
C0000040 flags
Initialized Data
Read Write

SECTION HEADER #4
.pdata name
1DA0 virtual size
24000 virtual address (00124000 to 00125D9F)
1E00 size of raw data
20600 file pointer to raw data (00020600 to 000223FF)
0 file pointer to relocation table
0 file pointer to line numbers
0 number of relocations
0 number of line numbers
40000040 flags
Initialized Data
Read Only

SECTION HEADER #5
.rsrc name
428 virtual size
26000 virtual address (00126000 to 00126427)
600 size of raw data
22400 file pointer to raw data (00022400 to 000229FF)
0 file pointer to relocation table
0 file pointer to line numbers
0 number of relocations
0 number of line numbers
40000040 flags
Initialized Data
Read Only

SECTION HEADER #6
.reloc name
2D26 virtual size
27000 virtual address (00127000 to 00129D25)
2E00 size of raw data
22A00 file pointer to raw data (00022A00 to 000257FF)
0 file pointer to relocation table
0 file pointer to line numbers
0 number of relocations
0 number of line numbers
42000040 flags
Initialized Data
Discardable
Read Only

Summary

3000 .data
2000 .pdata
5000 .rdata
3000 .reloc
1000 .rsrc
1B000 .text


I had try your solution, it prompt no error, but the application just hang
there, is it my CFReader.dll got problem ?

Anyway, thank you all very much... you all's reaply and advise really make
me feel touch and feel this newsgroup is warm!
Hope you all could conitnue help me.. thanks thanks..


Best regards,
Bsiang.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top