Cairo.WindowsHooksWrapper.NativeMethods.GetProcessPath C# (CSharp) Метод

GetProcessPath() публичный статический Метод

Retrieves the Path of a running process.
public static GetProcessPath ( IntPtr hwnd ) : string
hwnd System.IntPtr
Результат string
        public static string GetProcessPath(IntPtr hwnd)
        {
            try
            {
                uint pid = 0;
                GetWindowThreadProcessId (hwnd, out pid);
                Process proc = Process.GetProcessById ((int)pid); //Gets the process by ID.
                return proc.MainModule.FileName.ToString ();    //Returns the path.
            }
            catch (Exception ex)
            {
                return ex.Message.ToString ();
            }
        }