Beispiel #1
0
        /// <summary>
        /// Gets the process ID of the process that created the supplied window handle.
        /// </summary>
        /// <param name="hWnd">Handle to the main window of the process in question.</param>
        /// <returns>Returns non-zero on success, zero on failure.</returns>
        public static int GetProcessFromWindow(IntPtr hWnd)
        {
            int dwProcessId = 0;

            Imports.GetWindowThreadProcessId(hWnd, out dwProcessId);
            return(dwProcessId);
        }