精華區beta EzHotKey 關於我們 聯絡資訊
http://www.autohotkey.com/wiki/index.php?title=Internet_Explorer_Control Internet Explorer Control Contents 1 Overview 2 Functions 3 Example 4 Links Overview This is encapulation of COM object for embeding Internet Explorer control. Functions IE_Add(hWnd, x, y, w, h) IE_Move(pwb, x, y, w, h) IE_LoadURL(pwb, u) IE_LoadHTML(pwb, h) IE_GoBack(pwb) IE_GoForward(pwb) IE_GoHome(pwb) IE_GoSearch(pwb) IE_Refresh(pwb) IE_Stop(pwb) IE_Document(pwb) IE_GetTitle(pwb) IE_GetUrl(pwb) IE_Busy(pwb) IE_Quit(pwb) ; iexplore.exe only IE_hWnd(pwb) ; iexplore.exe only IE_FullName(pwb) ; iexplore.exe only IE_GetStatusText(pwb) ; iexplore.exe only IE_SetStatusText(pwb, sText = "") ; iexplore.exe only IE_ReadyState(pwb) IE_Open(pwb) IE_New(pwb) IE_Save(pwb) IE_SaveAs(pwb) IE_Print(pwb) IE_PrintPreview(pwb) IE_PageSetup(pwb) IE_Properties(pwb) IE_Cut(pwb) IE_Copy(pwb) IE_Paste(pwb) IE_SelectAll(pwb) IE_Find(pwb) IE_DoFontSize(pwb, s) IE_InternetOptions(pwb) IE_ViewSource(pwb) IE_AddToFavorites(pwb) IE_MakeDesktopShortcut(pwb) IE_SendEMail(pwb) CGID_MSHTML(pwb, nCmd, nOpt = 0) GetHostWindow(pwb) GetWebControl() UrlHistoryEnum() UrlHistoryClear() View | Download:http://www.autohotkey.net/~anonymous/COM/Wrappers/IEControl.ahk Example This example creates an IE control in an AHK GUI. Gui, +lastfound h := WinExist() IE_Add( h, 0, 0, 500, 500) ; Must be equal to or larger than the IE_Add size ; or some of the displayed web page will be cut off. Gui, Show, h500 w500 IE_LoadURL("www.yahoo.com") return This accomplishes much the same, but demonstrates some of the more advanced functionality. An explanation of how to establish CLSID and IID is given here: [1] #Include IEControl.ahk #SingleInstance force GoSub, GuiStart Gui, +LastFound +Resize Gui, Show, w800 h600 Center, WebBrowser hWnd := WinExist() CLSID_WebBrowser := "{8856F961-340A-11D0-A96B-00C04FD705A2}" IID_IWebBrowser2 := "{D30C1661-CDAF-11D0-8A3E-00C04FC9E26E}" pwb := CreateObject(CLSID_WebBrowser, IID_IWebBrowser2) AtlAxAttachControl(pwb, hWnd) IE_LoadURL(pwb, "http://www.autohotkey.com/") Sleep 5000 IE_LoadURL(pwb, "http://www.autohotkey.com/forum/") Sleep 5000 IE_GoBack(pwb) Sleep 3000 IE_GoForward(pwb) Return GuiStart: AtlAxWinInit() CoInitialize() Return GuiClose: Gui, %A_Gui%:Destroy Release(pwb) CoUninitialize() AtlAxWinTerm() ExitApp