首页 > 代码库 > 浏览器获取焦点

浏览器获取焦点

					HWND hActiveWnd = GetForegroundWindow();//获得当前激活的窗口句柄					DWORD SelfThreadId = GetCurrentThreadId();//获取本身的线程ID					DWORD ForeThreadId = GetWindowThreadProcessId(hActiveWnd,NULL);//根据窗口句柄获取线程ID					AttachThreadInput(ForeThreadId, SelfThreadId, true);//附加线程					hActiveWnd = GetFocus();//获取具有输入焦点的窗口句柄					if (hActiveWnd == GetClientMainWnd(hIEWindow) && hActiveWnd != hIEWindow)					{						::SetFocus(hIEWindow);					}

 

浏览器获取焦点