7,763
社区成员
发帖
与我相关
我的任务
分享
Private Sub TextBox1_GotFocus()
Me.Hide
Me.Enabled = False
Form2.Show
Form2.SetFocus
End Sub
Form2:
Private Sub Form_Activate()
Me.SetFocus
TextBox1.SetFocus
'MsgBox "!"
End Sub
Public Sub myFocus(hWnd&)
Dim hWnd&, hForeWnd&, dwForeID&, dwCurID&
hForeWnd = GetForegroundWindow()
dwForeID = GetWindowThreadProcessId(hForeWnd, 0)
dwCurID = GetCurrentThreadId()
AttachThreadInput dwCurID, dwForeID, True
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
End Sub
api和常数声明自己去api工具里复制