In short, you can now have multiple Shell.Explorers. No global variables needed. You'll be able to send special keys, such as Ctrl combinations, Enter, F keys, Tab, etc.
It's based off of the code found in Installer.ahk. I haven't seen the equivalent for AHK v2 - and haven't found one at all that doesn't require global variables. It also make for easily having multiple Shell.Explorers in one script.
Code: Select all
WM_KEYDOWN(wParam, lParam, Message, Handle)
{
If(WinGetClass("ahk_id " . Handle) = "Internet Explorer_Server"){
Browser := GuiCtrlFromHwnd(DllCall("GetParent", "UInt", DllCall("GetParent", "UInt", Handle))).Value
Accelerator_Table := ComObjQuery(Browser, "{00000117-0000-0000-C000-000000000046}")
VarSetCapacity(Tag_Message, 4 * A_PtrSize),
NumPut(lParam,NumPut(wParam,NumPut(Message,NumPut(Handle, &Tag_Message))))
Result := DllCall(NumGet(NumGet(Accelerator_Table) + 5 * A_PtrSize), "Ptr", Accelerator_Table, "Ptr", &Tag_Message)
ObjRelease(Accelerator_Table)
If Result = 0
Return 0
}
}
Code: Select all
Create_UI()
OnMessage(0x100, "WM_KEYDOWN", 2)
Return
Create_UI(){
GUI := GuiCreate("AlwaysOnTop OwnDialogs LastFound", "Sample")
GUI.MarginX := GUI.MarginY := 0
Browser := GUI.Add("ActiveX", "h600 vBrowser w800", "Shell.Explorer").Value
Browser.Silent := True
Browser.Navigate("http://justnotepad.com/")
GUI.Show()
Return GUI
}