コード例 #1
0
        /// <summary>
        /// 윈도우의 할성화된 프로세스 IntPtr을 구한다.
        /// </summary>
        /// <param name="sleeptime">구하기전 대기 시간(창선택 시간)</param>
        /// <returns></returns>
        public static void Current_WindowIntPtr_Get(int sleeptime, delRtnIntPtr evt)
        {
            //string processname = null;

            _intSleepTime = sleeptime;
            Thread th = new Thread(new ParameterizedThreadStart(_current_WindowIntPtr_Get));

            th.IsBackground = true;
            th.Start(evt);
        }
コード例 #2
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);
        }