toolhelp.dll PInvoke-Problem!?

C

Chris

Hi,
I am doing PInvoke-calls from managed C#code to unmanaged API toolhelp.dll.
The code I use to make the functions visible in .NET is the following:

[DllImport("toolhelp.dll")]
public static IntPtr CreateToolhelp32Snapshot(int flags,int procID);

this code is called further down in a differend method of the same class:


IntPtr processhandle = CreateToolhelp32Snapshot(0x00000002,0);

Being executed with CE.NET 4.2-Emulator, an error: MissingMethodException is
returned.

But executing the SAME code on PocketPC-emulator, everything works fine!
So: what is the issue!?

Please send me your comments!!
kind regars
Chris
 
D

Daniel Moth

Without even looking at the details when you get MissingMethodException
after a pinvoke, always check that the native dll is present in the image.
Is toolhelp.dll in your emulator?

Cheers
Daniel
 
C

Chris

Thank you, perhaps this could be a reason.

However, toolhelp API always is part of CE .NET as indicated in the feature
list. So why shouldn't the emulator - default in VS.NET2003 - be capable of
handling PInvokes to toolhelp-API?

Anyway, I am going to investigate on that!
thanks
Chris
 
D

Daniel Moth

You said CE 4.2 emulator. Non-PPC CE-based images can leave out (within
reason) any feature the like, so I would not expect the debugging service to
be there (it isn't on our released platform for example).

Now you say the emulator that ships with VS. That is not 4.2; it is a
4.1-based emulator.

Cheers
Daniel
 
C

Chris

Ah, that makes things more clear!
Is there a way to configure the emulator to be equipped with e.g.
toolhelp.dll by means of VS .NET 2003 or is there a need to engage Platform
Builder!?
regards
Chris
 
D

Daniel Moth

If you have the toolhelp.dll you can try copying it to the Windows folder of
the emulator. Otherwise you could build an SDK with PB and make sure your
image represents more closely the actual target it is going to run on.

Personally I would not do any serious development for a 4.2 device based on
the 4.1 VS emulator.

Cheers
Daniel
 
C

Chrisa

Very good! I will try this asap; don't mind if I seem to be a bit confusing
4.1 with 4.2: I am indeed a bit confused, since being still a newbie!

Thanks again for your professional assistance!
Chris.
 

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