private GetModuleFileName ( [ hModule, [ lpFilename, [ nSize ) : uint | ||
hModule | [ | |
lpFilename | [ | |
nSize | [ | |
Результат | uint |
/// <summary> /// Initializes a new instance of the <see cref="Win32ProcessIDHelper" /> class. /// </summary> public Win32ProcessIDHelper() { _currentProcessId = NativeMethods.GetCurrentProcessId(); var sb = new StringBuilder(512); if (0 == NativeMethods.GetModuleFileName(IntPtr.Zero, sb, sb.Capacity)) { throw new InvalidOperationException("Cannot determine program name."); } _currentProcessFilePath = sb.ToString(); }
/// <summary> /// Initializes a new instance of the <see cref="Win32ThreadIDHelper" /> class. /// </summary> public Win32ThreadIDHelper() { this.currentProcessID = NativeMethods.GetCurrentProcessId(); var sb = new StringBuilder(512); if (0 == NativeMethods.GetModuleFileName(IntPtr.Zero, sb, sb.Capacity)) { throw new InvalidOperationException("Cannot determine program name."); } this.currentProcessName = sb.ToString(); this.currentProcessBaseName = Path.GetFileNameWithoutExtension(this.currentProcessName); }