public string GetProcessName(int hwnd) { int pid; User32Wrapper.GetWindowThreadProcessId(hwnd, out pid); var process = Process.GetProcessById(pid); return(process.ProcessName); }
public string GetExecutableFilename(int hwnd) { var result = ""; int pid; User32Wrapper.GetWindowThreadProcessId(hwnd, out pid); var process = Process.GetProcessById(pid); try { result = process.MainModule.FileName; } catch { } return(result); }