如何获取google chrome浏览器活动标签的Url(vb6) [英] how to get google chrome web browser active tab's Url (vb6)

查看:1497
本文介绍了如何获取google chrome浏览器活动标签的Url(vb6)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我没有从Chrome版本29获取网址。因为使用spy ++无法找到网址控制。

i do not get the url from chrome Version29.because url control can not be found using 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



我使用vb6

I am using vb6

推荐答案

Chrome不再使用Chrome_OmniboxView。
我也在寻找一个新的解决方案...

Chrome is no longer using Chrome_OmniboxView. I'm also looking for a new solution...

这篇关于如何获取google chrome浏览器活动标签的Url(vb6)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆