var<br> w:HWND;<br> buf:TKeyBoardState;<br>begin<br><br>w:= 你还是找到现在激活的窗口<br><br>if(not AttachThreadInput(GetWindowThreadProcessId(w,nil),GetCurrentThreadId(),true))then<br> RaiseLastWin32Error();<br><br>GetKeyboardState(buf);<br>buf[VK_SHIFT]:=BYTE(buf[VK_SHIFT] or $80);<br>SetKeyboardState(buf);<br>PostMessage(w,WM_KEYDOWN,VK_TAB,0);<br>PostMessage(w,WM_KEYUP,VK_TAB,1);<br><br>if(not AttachThreadInput(GetWindowThreadProcessId(w,nil),GetCurrentThreadId(),false))then<br> RaiseLastWin32Error();<br>end;<br>