Windows Explorer in a GUI

Discuss Autohotkey related topics here. Not a place to share code.
Forum rules
Discuss Autohotkey related topics here. Not a place to share code.
User avatar
kczx3
Posts: 1640
Joined: 06 Oct 2015, 21:39

Windows Explorer in a GUI

Post by kczx3 » 28 Oct 2020, 13:23

Not really sure where to post this (and maybe it is common knowledge that I didn't have) but apparently you can nest a file explorer control inside of an AHK GUI using the Shell.Explorer ActiveX control.

If you open up a normal IE instance and navigate to a local directory, that directory will be opened in a new Explorer.exe window. However, if you instead use AHK to create a gui with an ActiveX control of Shell.Explorer and then navigate to a local directory, that will essentially render the Explorer.exe listview inside your GUI. I never knew that and wasn't sure if anyone else did. Might be useful for someone!

NOTE: The following uses AHK v2-a121 code.

Code: Select all

#Requires AutoHotkey v2.0-a121
main := gui.new()

wb := main.add("ActiveX", "w400 h400", "Shell.Explorer").value

wb.navigate("file:///C:/")

main.show()
image.png
image.png (26.49 KiB) Viewed 1824 times

gregster
Posts: 9012
Joined: 30 Sep 2013, 06:48

Re: Windows Explorer in a GUI

Post by gregster » 28 Oct 2020, 13:27

Nice find. Thank you! :thumbup:
Perhaps something for Tips & Tricks ? Or v2 'Scripts and Functions' ?

Hamborgar
Posts: 14
Joined: 28 Sep 2020, 09:57

Re: Windows Explorer in a GUI

Post by Hamborgar » 28 Oct 2020, 13:29

:happybday:

Post Reply

Return to “General Discussion”