问答文章1 问答文章501 问答文章1001 问答文章1501 问答文章2001 问答文章2501 问答文章3001 问答文章3501 问答文章4001 问答文章4501 问答文章5001 问答文章5501 问答文章6001 问答文章6501 问答文章7001 问答文章7501 问答文章8001 问答文章8501 问答文章9001 问答文章9501

...取得当前页面的URL,必须兼容所有IE内核的浏览器(如360浏览器)_百度...

发布网友 发布时间:2024-10-19 14:39

我来回答

1个回答

热心网友 时间:2024-11-12 09:04

以下代码在360浏览器下调试成功。分两步:一、把下面代码复制到一个模块中:Option ExplicitDeclare Function FindWindowEx Lib "user32" Alias "FindWindowExA" (ByVal hWnd1 As Long, ByVal hWnd2 As Long, ByVal lpsz1 As String, ByVal lpsz2 As String) As LongPublic Declare Function SetCapture Lib "user32" (ByVal hWnd As Long) As LongPublic Declare Function GetCursorPos Lib "user32" (lpPoint As PointAPI) As LongPublic Declare Function WindowFromPoint Lib "user32" (ByVal xPoint As Long, ByVal yPoint As Long) As LongPublic Declare Function ScreenToClient Lib "user32" (ByVal hWnd As Long, lpPoint As PointAPI) As LongType PointAPI x As Long Y As LongEnd TypePrivate Type UUID Data1 As Long Data2 As Integer Data3 As Integer Data4(0 To 7) As ByteEnd TypePrivate Declare Function GetClassName Lib "user32" _ Alias "GetClassNameA" ( _ ByVal hWnd As Long, _ ByVal lpClassName As String, _ ByVal nMaxCount As Long) As LongPrivate Declare Function EnumChildWindows Lib "user32" ( _ ByVal hWndParent As Long, _ ByVal lpEnumFunc As Long, _ lParam As Long) As LongPrivate Declare Function RegisterWindowMessage Lib "user32" _ Alias "RegisterWindowMessageA" ( _ ByVal lpString As String) As LongPrivate Declare Function SendMessageTimeout Lib "user32" _ Alias "SendMessageTimeoutA" ( _ ByVal hWnd As Long, _ ByVal msg As Long, _ ByVal wParam As Long, _ lParam As Any, _ ByVal fuFlags As Long, _ ByVal uTimeout As Long, _ lpdwResult As Long) As LongPrivate Const SMTO_ABORTIFHUNG = &H2Private Declare Function ObjectFromLresult Lib "oleacc" ( _ ByVal lResult As Long, _ riid As UUID, _ ByVal wParam As Long, _ ppvObject As Any) As LongPrivate Declare Function FindWindow Lib "user32" _ Alias "FindWindowA" ( _ ByVal lpClassName As String, _ ByVal lpWindowName As String) As Long'Function IEDOMFromhWnd(ByVal hWnd As Long) As IHTMLDocumentDim IID_IHTMLDocument As UUIDDim hWndChild As LongDim lRes As LongDim lMsg As LongDim hr As Long If hWnd <> 0 Then If Not IsIEServerWindow(hWnd) Then ' Find a child IE server window EnumChildWindows hWnd, AddressOf EnumChildProc, hWnd End If If hWnd <> 0 Then ' Register the message lMsg = RegisterWindowMessage("WM_HTML_GETOBJECT") ' Get the object pointer Call SendMessageTimeout(hWnd, lMsg, 0, 0, _ SMTO_ABORTIFHUNG, 1000, lRes) If lRes Then ' Initialize the interface ID With IID_IHTMLDocument .Data1 = &H626FC520 .Data2 = &HA41E .Data3 = &H11CF .Data4(0) = &HA7 .Data4(1) = &H31 .Data4(2) = &H0 .Data4(3) = &HA0 .Data4(4) = &HC9 .Data4(5) = &H8 .Data4(6) = &H26 .Data4(7) = &H37 End With ' Get the object from lRes hr = ObjectFromLresult(lRes, IID_IHTMLDocument, _ 0, IEDOMFromhWnd) End If End If End IfEnd FunctionPrivate Function IsIEServerWindow(ByVal hWnd As Long) As BooleanDim lRes As LongDim sClassname As String sClassname = String$(100, 0) lRes = GetClassName(hWnd, sClassname, Len(sClassname)) sClassname = Left$(sClassname, lRes) IsIEServerWindow = StrComp(sClassname, _ "Internet Explorer_Server", _ vbTextCompare) = 0End Function'Function EnumChildProc(ByVal hWnd As Long, lParam As Long) As Long If IsIEServerWindow(hWnd) Then lParam = hWnd Else EnumChildProc = 1 End IfEnd Function二、建立一个窗体,加入按钮command1,并复制下面代码:Private Sub Command1_Click()Dim doc, wnd As Longwnd = FindWindow("360se5_Frame", vbNullString)wnd = FindWindowEx(wnd, 0, "SeWnd", vbNullString)wnd = FindWindowEx(wnd, 0, "XWnd", vbNullString)wnd = FindWindowEx(wnd, 0, "Container", vbNullString)wnd = FindWindowEx(wnd, 0, "Shell Embedding", vbNullString)wnd = FindWindowEx(wnd, 0, "Shell DocObject View", vbNullString)wnd = FindWindowEx(wnd, 0, "Internet Explorer_Server", vbNullString)Set doc = IEDOMFromhWnd(wnd)MsgBox "360浏览器当前的网址是:" & doc.URLEnd Sub三、打开360浏览器,随便浏览某个网址。然后运行本程序,点击command1按钮,Ok!
声明声明:本网页内容为用户发布,旨在传播知识,不代表本网认同其观点,若有侵权等问题请及时与本网联系,我们将在第一时间删除处理。E-MAIL:11247931@qq.com
通达信主力指标公式汇总(2023版附源码) 有什么类似地下城与勇士的手机游戏 有没有类似于DNF的游戏 苹果手机类似地下城的游戏 有什么类似地下城与勇士的手机游戏 我的系统是WIN732,为什么玩不了光晕2,一点开就弹一个对话框出来说:无法... 玩诛仙电脑配置诛仙3要求电脑配置 ...永磁为什么要跌啊?东方财富金力永磁股吧?金力永磁股票最初..._百度... 怎么找回注销的微信号 如果把手机号码和微信号同时销户后期还能找回微信号吗? 仓储与库存有什么区别? 仓位和库位的区别 千家诗《张继·枫桥夜泊》题解与鉴赏 年轻人会痛风吗?吃什么药好? 御农降酸茶五大特点 ...系统设置apk安装在内置存储卡上,酷狗音乐下载的音乐就只 为什么我创的QQ群解散不了?解散的时候提示网络繁忙,T人也T不了,设置也... 大家帮我看看房子,名佳花园一区,精致装修58平方,大约多少钱啊?中伟置地... 这些人取自什么成语 ch取自什么成语 炸酱面的酱是怎么制作的 做炸酱面怎么做酱呢 肇东有到松原的火车吗 绥化走兰西,肇东,昌武,到松原开车怎么走 中医治疗肾囊肿效果 肾囊肿中药治疗有效吗 ...抓包的接口列表只有adapter for loopback traffic capture,要怎么解 ... 火柴人入侵者2修改版游戏介绍 怎么辨别变速箱有问题 变速箱有问题会是什么样的表现 qq宠物社区里的冒险岛的最后一关(大结局-宝藏)有没有开放拉 QQ宠物的冒险岛可以重复吗? 锻炼宝宝抓握能力的方法有哪些呢? 如何用VB指定一个位置的浏览器打开固定网页页面? 金立e6手机是几g网 想明白了再结婚中王丽坤用的什么手机 昂达主板,在bios设置光盘启动后不能成功从光盘启动,F10当然按过。_百 ... 在淘宝上买了东西后,我选择的是去邮局汇款。请问是汇款单还是帐号汇款... 吃什么有利于灌肠顺利? 家云智能家居怎么样 深圳云里物联科技有限公司怎么样 家云智能家居怎么样,产品特点有哪些 四川达州的西北方有啥城市 金立elife e7什么时候发布? ...小正方形拼成一个长方体,拼成的长方体表面积最大是多少?最小是_百... 卡其是斜纹组织吗? 上海注册公司员工可以把户口迁到上海吗? 听说在上海开公司满五年的本科学历的老板,可以申请上海户口,是真的吗... 在上海开公司,能办理上海市户口么? 骑别人的摩托车摔做手术,别人叫我赔钱要赔吗 环太平洋2口碑和评分下降原因是什么 首周末即斩获4亿票房 有驾驶证骑摩托车载人,被载人摔死了,骑摩托车的要负刑事责任吗 女孩取名,姓白,五行缺金2012年农历五月十四出生,望大师指点个名字