[AHK v2] Shell.Explorer - Enter / Tab / Etc - No Globals - Multiple Controls

Post your working scripts, libraries and tools.
Wicked
Posts: 40
Joined: 05 Jun 2016, 20:34

[AHK v2] Shell.Explorer - Enter / Tab / Etc - No Globals - Multiple Controls

08 Dec 2018, 06:14

Hi, guys.

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
    }
}
You can try it with this script. Just comment the OnMessage(0x100, "WM_KEYDOWN", 2) line to see what it's like without:

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
}
Last edited by Wicked on 10 Dec 2018, 19:04, edited 4 times in total.
User avatar
kczx3
Posts: 1640
Joined: 06 Oct 2015, 21:39

Re: [AHK v2] Shell.Explorer - Enter / Tab / Etc - No Globals

08 Dec 2018, 21:26

👍🏻 Glad you figured it out!
Wicked
Posts: 40
Joined: 05 Jun 2016, 20:34

Re: [AHK v2] Shell.Explorer - Enter / Tab / Etc - No Globals

10 Dec 2018, 19:05

kczx3 wrote:
08 Dec 2018, 21:26
👍🏻 Glad you figured it out!
I didn't realize AHK v2 got rid of A_GuiX and A_GuiY until I read the changelog. That clued me in. :-P.

Return to “Scripts and Functions (v2)”

Who is online

Users browsing this forum: jacek678 and 31 guests