4个回答
展开全部
Private Declare Function FindWindow Lib "user32" Alias "FindWindowA" (ByVal lpClassName As String, ByVal lpWindowName As String) As Long
Private Declare Function SendMessage Lib "user32" Alias "SendMessageA" (ByVal hwnd As Long, ByVal wMsg As Long, ByVal wParam As Long, lParam As Any) As Long
Private Const WM_CLOSE = &H10
'关闭IE弹出的对话框
Private Sub Timer1_Timer()
hwnd1 = FindWindow("#32770", "Windows Internet Explorer")
'每个窗体的类名都可能不同,所以请在网上下载一个叫spy++的软件,即可取得目标窗体类名,该窗体的类名是不变的,所以只要取一次填上就可以了
'IE 7
hwnd2 = FindWindow("#32770", "Microsoft Internet Explorer")
'IE 6
If hwnd1 <> 0 Then
SendMessage hwnd1, WM_CLOSE, 0, 0
End If
If hwnd2 <> 0 Then
SendMessage hwnd2, WM_CLOSE, 0, 0
End If
End Sub
Private Declare Function SendMessage Lib "user32" Alias "SendMessageA" (ByVal hwnd As Long, ByVal wMsg As Long, ByVal wParam As Long, lParam As Any) As Long
Private Const WM_CLOSE = &H10
'关闭IE弹出的对话框
Private Sub Timer1_Timer()
hwnd1 = FindWindow("#32770", "Windows Internet Explorer")
'每个窗体的类名都可能不同,所以请在网上下载一个叫spy++的软件,即可取得目标窗体类名,该窗体的类名是不变的,所以只要取一次填上就可以了
'IE 7
hwnd2 = FindWindow("#32770", "Microsoft Internet Explorer")
'IE 6
If hwnd1 <> 0 Then
SendMessage hwnd1, WM_CLOSE, 0, 0
End If
If hwnd2 <> 0 Then
SendMessage hwnd2, WM_CLOSE, 0, 0
End If
End Sub
参考资料: http://quwen168.com
展开全部
Declare Function FindWindow Lib "user32" Alias "FindWindowA" (ByVal lpClassName As String, ByVal lpWindowName As String) As Long
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
展开全部
调用API找到对话框句柄,再操作
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
展开全部
使用API找到想要关闭窗体的句柄
再用API关闭这个句柄窗体
具体代码网上找找
再用API关闭这个句柄窗体
具体代码网上找找
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询