chrome无法获取地址栏
这个代码2012年还能获得浏览器地址,但是现在无法获取,用spy看了下和以前的一样,什么原因?
Option Explicit
Private Const WM_GETTEXT = &HD
Private Const WM_GETTEXTLENGTH = &HE
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 Declare Function GetDesktopWindow Lib "user32" () As Long
Private Declare Function FindWindow Lib "user32" Alias "FindWindowA" (ByVal lpClassName As String, ByVal lpWindowName As String) As Long
Private Declare Function FindWindowEx Lib "user32" Alias "FindWindowExA" (ByVal hWnd1 As Long, ByVal hWnd2 As Long, ByVal lpsz1 As String, ByVal lpsz2 As String) As Long
Private Sub Command1_Click()
Dim dhWnd As Long
Dim chWnd As Long
Dim Web_Caption As String * 256
Dim Web_hWnd As Long
Dim URL As String * 256
Dim URL_hWnd As Long
dhWnd = GetDesktopWindow
chWnd = FindWindowEx(dhWnd, 0, "Chrome_WidgetWin_1", vbNullString)
Web_hWnd = FindWindowEx(dhWnd, chWnd, "Chrome_WidgetWin_1", vbNullString)
URL_hWnd = FindWindowEx(Web_hWnd, 0, "Chrome_OmniboxView", vbNullString)
Call SendMessage(Web_hWnd, WM_GETTEXT, 256, ByVal Web_Caption)
Call SendMessage(URL_hWnd, WM_GETTEXT, 256, ByVal URL)
MsgBox Split(Web_Caption, Chr(0))(0) & vbCrLf & Split(URL, Chr(0))(0)
End Sub --------------------编程问答-------------------- 自己顶啊啊啊啊
补充:VB , 网络编程