1 / 4
文档名称:

2022年获取 IE 当前 URL 的代码源码精华教程.docx

格式:docx   大小:11KB   页数:4页
下载后只包含 1 个 DOCX 格式的文档,没有任何的图纸或源代码,查看文件列表

如果您已付费下载过本站文档,您可以点这里二次下载

分享

预览

2022年获取 IE 当前 URL 的代码源码精华教程.docx

上传人:mama1 2022/6/17 文件大小:11 KB

下载得到文件列表

2022年获取 IE 当前 URL 的代码源码精华教程.docx

相关文档

文档介绍

文档介绍:2022年获取 IE 当前 URL 的代码源码精华教程
获得 IE 当前 URL 的代码,网上有很多类似代码,但在WINDOWSXP 下不能运行。查了一些资料,发觉由于Win2000,WINXP 是基于Unicode代码的操作系统,所以没2022年获取 IE 当前 URL 的代码源码精华教程
获得 IE 当前 URL 的代码,网上有很多类似代码,但在WINDOWSXP 下不能运行。查了一些资料,发觉由于Win2000,WINXP 是基于Unicode代码的操作系统,所以没有WorkerA类,而以WorkerW类取而代之(XXXXA should be used on not unicode compliant windows oses likes Windows 95,98 etc and on unicode enabled oses replace A with W. Remember WorkerA or WorkerW doesn't have something related to IE version. To obtain all of the opened IEs URL use EnumWindows callback function and cheers. )。
Option Explicit
Private Declare Function FindWindow Lib user32 Alias FindWindowA (ByVal lpClassName As String, ByVal lpWindowName As String) As Long 'Findwindow函数的功能是找到当前运行的IE窗口的url地址的句柄
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 'FindwindowEx函数的功能是找到子窗体的句柄
Private Declare Function SendMessageByString Lib user32 Alias SendMessageA (ByVal hwnd As Long, ByVal wMsg As Long, ByVal wParam As Long, ByVal lParam As String) As Long
Private Const WM_GETTEXT = HD
Private Sub Command1_Click()
getcurrenturl
End Sub
Sub getcurrenturl(Optional ByRef URL As String)
Dim hwnd As Long '设定一个长整形变量用来接收函数返回值
hwnd = 0 '初始化
hwnd = FindWindowEx(hwnd, 0, IEFrame, vbNullStr