#2
不说也罢2016-09-06 17:14
|
VC代码:
if(hWnd)
{
HWND hForeWnd = ::GetForegroundWindow();
DWORD dwForeID = ::GetWindowThreadProcessId(hForeWnd,NULL);
DWORD dwCurID = ::GetCurrentThreadId();
::AttachThreadInput(dwCurID,dwForeID,TRUE);
::ShowWindow(hWnd,SW_SHOWNORMAL);
::SetWindowPos(hWnd,HWND_TOPMOST,0,0,0,0,SWP_NOSIZE|SWP_NOMOVE);
::SetWindowPos(hWnd,HWND_NOTOPMOST,0,0,0,0, SWP_NOSIZE|SWP_NOMOVE);
::SetForegroundWindow(hWnd);
::AttachThreadInput(dwCurID,dwForeID,FALSE);
return 0;
}
自己改写的运行出错:
Dim hForeWnd As Integer = GetForegroundWindow()
Dim dwForeID As Integer = GetWindowThreadProcessId(hForeWnd, 0)
Dim dwCurID As Integer = GetCurrentThreadId()
AttachThreadInput(dwCurID, dwForeID, 1)
ShowWindow(hWnd, SW_SHOWNORMAL)
SetWindowPos(hWnd, HWND_TOPMOST, 0, 0, 0, 0, SWP_NOSIZE And SWP_NOMOVE)
SetWindowPos(hWnd, HWND_NoTopmost, 0, 0, 0, 0, SWP_NOSIZE And SWP_NOMOVE)
SetForegroundWindow(hWnd)
AttachThreadInput(dwCurID, dwForeID, 0)