Private Declare Function FindWindow Lib "USER32" Alias "FindWindowA" (ByVal lpClassName As String, ByVal lpWindowName As String) As LongPrivate Declare Function FindWindowEx Lib "USER32" Alias "FindWindowExA" (ByVal hWnd1 As Long, ByVal hWnd2 As Long, ByVal lpsz1 As String, ByVal lpsz2 As String) As LongPrivate Declare Function SendMessage Lib "USER32" Alias "SendMessageA" (ByVal hwnd As Long, ByVal wMsg As Long, ByVal wParam As Long, lParam As Any) As LongPrivate Const BM_CLICK = &HF5
Sub aa()Dim hwd As Long, hwd_child As Longhwd = FindWindow("#32770", "文件下载 - 安全警告") '网页对话框的句柄hwd_child = FindWindowEx(hwd, 0, "button", "保存(&S)") ‘保存按钮的句柄SendMessage hwd_child, BM_CLICK, 0, 0 '发送鼠标单击End Sub
这是网上下载软件弹出来的网页对话框,hwd 和hwd_child都能找到,但是就是点不了保存按钮,如果焦点在取消按钮上,这段代码只会把焦点放到保存按钮上来,而不会点下去,怎么回事?如图:
如何获得文件链接?我只有一个地址url1,这个地址不是以文件名结尾,设置document.location.href=url1以后下载框就弹出来了