Private Declare Function FindWindow Lib "user32" Alias "FindWindowA" (ByVal lpClassName As String, ByVal lpWindowName As String) As Long
Private Sub Form_Load()
Dim hWnd As Long
Dim x As String
Do While x <> "a"
hWnd = FindWindow(0&, 0&)
x = InputBox(hWnd)
Loop
End Sub
可以看到hWnd一直是0,不知道是为什么
Private Declare Function FindWindow Lib "user32" Alias "FindWindowA" 历型槐(ByVal lpClassName As String, ByVal 肢友lpWindowName As String) As Long
Private Sub Form_Load()
Dim hWnd As Long
Dim x As String
Do While x <> 0
租睁hWnd = FindWindow(vbNullString, x)
x = InputBox(hWnd)
Loop
End Sub
FindWindow里需要传入值才能获取句柄
对啊。孙乎。你想得握凯碰到什么句柄,findwindow那段谈行写错了,hWnd = FindWindow(vbNullString, "窗口的名字")