A
arc
How to obtain the Module/Process Name of the application within?
Basically i am trying to simulate - GetModuleFileNameW
Trying this: (which doesnt work)
ProcessModule procModule = new ProcessModule(); //Gives an error
here without hinting on the right syntax
string szModulePath = procModule.FileName.ToString();
What is the right way of getting this working in .NET???
I even tried using GetModuleFileNameW by using [DllImport("Kernel32.dll")]
but could not marshal the second parameter right.
[DllImport("Kernel32.dll")]
public static extern IntPtr GetModuleFileNameW(
IntPtr hModule,
[MarshalAs(UnmanagedType.SafeArray)]
String[] lpFilename,
Int32 nSize
);
When I make a call could only obtain value 'C' in szModulePath instead of
'C:\\xxx\xx\x.x"
string[] szModulePath = {};
int iRetVal = (int)GetModuleFileNameW(OwnerHandle,szModulePath,MAXI_PATH);
- Arc
Basically i am trying to simulate - GetModuleFileNameW
Trying this: (which doesnt work)
ProcessModule procModule = new ProcessModule(); //Gives an error
here without hinting on the right syntax
string szModulePath = procModule.FileName.ToString();
What is the right way of getting this working in .NET???
I even tried using GetModuleFileNameW by using [DllImport("Kernel32.dll")]
but could not marshal the second parameter right.
[DllImport("Kernel32.dll")]
public static extern IntPtr GetModuleFileNameW(
IntPtr hModule,
[MarshalAs(UnmanagedType.SafeArray)]
String[] lpFilename,
Int32 nSize
);
When I make a call could only obtain value 'C' in szModulePath instead of
'C:\\xxx\xx\x.x"
string[] szModulePath = {};
int iRetVal = (int)GetModuleFileNameW(OwnerHandle,szModulePath,MAXI_PATH);
- Arc