Desktop Functions: Smart Device Functions:
|
Search Results for "GetModuleFileName" in [All]psapi
Used in conjuction with GetModuleFileNameEx:
GetModuleFileNameEx(p.Handle, hMods[i], strbld, (uint)(strbld.Capacity));
static extern uint GetModuleFileNameEx(IntPtr hProcess, IntPtr hModule, [Out] StringBuilder lpBaseName, [In] [MarshalAs(UnmanagedType.U4)] int nSize);
Public Shared Function GetModuleFileNameEx(ByVal hProcess As IntPtr, ByVal hModule As IntPtr, <Out()> ByVal lpBaseName As StringBuilder, <[In]()> <MarshalAs(UnmanagedType.U4)> ByVal nSize As Integer) As UInteger
static extern uint GetModuleFileNameEx(IntPtr hProcess, IntPtr hModule, [Out] StringBuilder lpBaseName, uint nSize);
GetModuleFileNameEx(p.Handle, hMods[i], strbld, (uint)(strbld.Capacity)); This can be used in place of the GetModuleFileName call, which doesn't work on processes that haven't been loaded by the current one. I found this to be more comprehensive than GetModuleFileNameEx. Didnt need to enumerate windows or modules kernel32
public static extern uint GetModuleFileName
Public Function GetModuleFileName(<[In]()> ByVal hModule As IntPtr, <Out()> ByVal lpFilename As StringBuilder, <[In]()> <MarshalAs(UnmanagedType.U4)> ByVal nSize As Integer) As UInteger If you want to use GetModuleFilename to retrieve the path the current executable was started from, you should instead consider using System.Windows.Forms.Application.StartupPath. This is a wrapper around GetModuleFilename, so it probably does exactly what you want.
DllFuntions.GetModuleFileName(IntPtr.Zero, fileName, fileName.Capacity); coredllTo locate the file for a module that was loaded by current process, use the GetModuleFileName function.
static extern int GetModuleFileNameEx(IntPtr hProcess, IntPtr hModule, StringBuilder lpFilename, int nSize);
Declare Function GetModuleFileNameEx Lib "coredll.dll" (ByVal hProcess As IntPtr, ByVal hModule As IntPtr, ByVal lpFileName As System.Text.StringBuilder, ByVal nSize As Int32) As Int32 To locate the file for a module that was loaded by current process, use the GetModuleFileName function.
static extern int GetModuleFileNameEx(IntPtr hProcess, IntPtr hModule, StringBuilder lpFilename, int nSize);
Declare Function GetModuleFileNameEx Lib "coredll.dll" (ByVal hProcess As IntPtr, ByVal hModule As IntPtr, ByVal lpFileName As System.Text.StringBuilder, ByVal nSize As Int32) As Int32 |