Jump to content
Sign in to follow this  
Achilles

Making a windows control in my GUI

Recommended Posts

dworld

Anybody know a way to make this in my GUI, I could probably make it with a treeview but it wouldn't look as nice plus this way would be easier...

post-14131-1216845124_thumb.jpg

Hi,

the following code embed the explorer to your gui. I know that is not the perfect solution, but it could be :P if you find the way, how to open explorer.exe to show only the SysTreeView control.

This time i did it with my hands, i mean to turn off all toolbars in and resize the explorer window. And it looks like as follows:

Posted Image

I'll try to find the way how to embed only a windows control.

This code is able to embedd almost all windows application into the gui, which is not runnin on fullscreen:

CODE
#include <GuiConstants.au3>

Opt('MustDeclareVars', 1)

Global $hGUI

Global $hTree ; handle of the opened window

$hGUI = GUICreate("Embedded Explorer", 800, 800)

GUISetState(@SW_SHOW)

Run('C:\WINDOWS\explorer.exe')

sleep(2000) ; wait for window

$hTree = WinGetHandle("", "FolderView")

If $hTree <> "" Then ; if the handle is empty the program will exit.

; embedding...

DllCall("user32.dll", "hwnd", "SetParent", "hwnd", $hTree, "hwnd", $hGUI)

DllCall("user32.dll", "long", "SetWindowLong", "hwnd", $hTree, "int", -20, "long", 0x80000000 + 0x40000000 + 0x00000080) ; of course you can change the embedding options(0x80000000)

WinMove($hTree, '', 10, 10, 385, 770) ; after the embedding you can move the window to the correct pos.

Else

MsgBox(0, "Debug", "Couldn't take control over window. Exiting...")

Exit

EndIf

While 1

Switch GUIGetMsg()

Case $GUI_EVENT_CLOSE

ExitLoop

EndSwitch

WEnd


dworldI'm new in autoit, but I like it. My mind is open to the new things.

Share this post


Link to post
Share on other sites
dworld

damn shity image hosting site..

here is the pic again i hope this time it'll be ok. If not i ask a moderator, please delete the link; thx in advance.

Posted Image

Actually i found a way to embed only the SysTreeView32 control into the gui. It is very simple:

Posted Image

There is a problem, i dont know the methods of this object, that's why i couldn't add tree items yet...

I found the object name in the registry here: HKEY_CLASSES_ROOT\CLSID\{C74190B6-8589-11D1-B16A-00C0F0283628}\ProgID

here is the code:

CODE
#include <GuiConstants.au3>

Global $oTree

$hGUI = GUICreate("Embedded Explorer", 400, 400)

GUISetState(@SW_SHOW)

$oTree = ObjCreate("MSComctlLib.TreeCtrl.2") ; I found the object name in the registry, HKEY_CLASSES_ROOT\CLSID\{C74190B6-8589-11D1-B16A-00C0F0283628}\ProgID

if not IsObj($oTree) then

Msgbox(0,"Error","$oTree is not an Object.")

Exit

else

Msgbox(0,"Error","Successfully created Object $oTree.")

GUICtrlCreateObj ($oTree, 10, 10, 360, 200)

; adding treeitems could come here...

; $oTree.AddNode("first") ; not working yet, i tried a lot ways and also search on the net without success

endif

While 1

Switch GUIGetMsg()

Case $GUI_EVENT_CLOSE

ExitLoop

EndSwitch

WEnd


dworldI'm new in autoit, but I like it. My mind is open to the new things.

Share this post


Link to post
Share on other sites
BrettF

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.