Carl
8/15/2007 11:51:00 AM
Hi,
I've got stuck on calling the following WinApi function. I've tried lots of
different datatypes and read alot about which to use in the documentations,
but everything fails. Does anyone know how to do it?
The Call:
StringBuilder sb = new StringBuilder(255);
IntPtr handle = new IntPtr();
uint result = GetModuleFileName(handle, out sb, (uint)255);
I want to send "null" as the handle, to get the currently running process
path.
My import declaration:
[DllImport("Kernel32.dll")]
public static extern uint GetModuleFileName(IntPtr Handle, out StringBuilder
Filename, uint Size);
The MSDN documentation of the Api:
DWORD WINAPI GetModuleFileName(
HMODULE hModule,
LPTSTR lpFilename,
DWORD nSize
);
I hope someone can assist me with this!
regards
Carl