Пример #1
0
        private static void _current_WindowIntPtr_Get(object obj)
        {
            //string processname = null;

            Thread.Sleep(_intSleepTime);

            IntPtr hwnd = API_Windows.GetForegroundWindow();

            delRtnIntPtr evt = obj as delRtnIntPtr;

            if (obj == null)
            {
                return;
            }

            evt(hwnd);
        }
Пример #2
0
        /// <summary>
        /// 프로세스 IntPtr로 프로세스를 가져온다
        /// </summary>
        /// <param name="hwnd"></param>
        /// <returns></returns>
        public static System.Diagnostics.Process WindowProcess_Get_byHWnd(IntPtr hwnd)
        {
            try
            {
                uint pid;
                API_Windows.GetWindowThreadProcessId(hwnd, out pid);

                System.Diagnostics.Process cur = System.Diagnostics.Process.GetProcessById((int)pid);

                if (cur == null)
                {
                    return(null);
                }

                return(cur);
            }
            catch
            {
                return(null);
            }
        }
Пример #3
0
        public static IntPtr Current_WindowIntPtr_Get()
        {
            //string processname = null;

            return(API_Windows.GetForegroundWindow());
        }