Ok
I see the........
System.Runtime.InteropServices.DllImport("winmm.DLL", EntryPoint =
"PlaySound", SetLastError = true)]
private static extern bool PlaySound(string szSound, System.IntPtr
hMod, PlaySoundFlags flags);
but how do know or find out what the entry point of a 3rd party DLL would
be?
> Hello Jason,
>
[quoted text clipped - 14 lines]
> "At times one remains faithful to a cause only because its opponents do
> not cease to be insipid." (c) Friedrich Nietzsche
Michael Nemtsev - 31 Oct 2006 22:07 GMT
Hello Jason,
Obviously from the your dll manuals. They should provide u the list of functions
they export
btw, read a bit there http://samples.gotdotnet.com/quickstart/howto/doc/Interop/PInvoke_Simple.aspx
J> Ok
J>
J> I see the........
J>
J> System.Runtime.InteropServices.DllImport("winmm.DLL", EntryPoint =
J> "PlaySound", SetLastError = true)]
J> private static extern bool PlaySound(string szSound,
J> System.IntPtr
J> hMod, PlaySoundFlags flags);
J> but how do know or find out what the entry point of a 3rd party DLL
J> would be?
J>
J> "Michael Nemtsev" <nemtsev@msn.com> wrote in message
J> news:1799a79b3b9d8e8c8cb504f2d47d4@msnews.microsoft.com...
J>
>> Hello Jason,
>>
[quoted text clipped - 16 lines]
>> "At times one remains faithful to a cause only because its opponents
>> do not cease to be insipid." (c) Friedrich Nietzsche
---
WBR,
Michael Nemtsev :: blog: http://spaces.live.com/laflour
"At times one remains faithful to a cause only because its opponents do not
cease to be insipid." (c) Friedrich Nietzsche
Willy Denoyette [MVP] - 31 Oct 2006 22:13 GMT
> Ok
>
[quoted text clipped - 6 lines]
>
> but how do know or find out what the entry point of a 3rd party DLL would be?
Are you sure the DLL is exporting C style functions, that is, is the DLL meant to be used
from clients using "C style" bindings? C# and PInvoke cannot call exported C++ class
members. Another thing you need to know is the calling convention used for the exports. You
can try to get at the exports using tools like depends.exe and dumpbin.exe from the platform
SDK, but what you really need is the documentation that describes the exported functions
their argument types ,calling convention and semantics .
Willy.
Wilfried Mestdagh - 31 Oct 2006 22:13 GMT
Hi Jason,
You only need the EntryPoint if you choose a different name. For example
this is a part of code to access a DLL of me:
[DllImport(Tools.dllName, EntryPoint = "Initialize")]
public static extern void InitializeApi();
[DllImport(Tools.dllName)]
public static extern void Disconnect();
The first one, 'Initialize' is an error in C# because it is already
existant, so I renamed it to InitializeApi. The second one 'Disconnect'
I did not rename, so no EntryPoint needed.
hope this helps.

Signature
rgds, Wilfried [MapPoint MVP]
http://www.mestdagh.biz