KaFu Posted February 12, 2010 Share Posted February 12, 2010 somehow I've got the feeling it's not the most elegant and resource friendly way . Any thoughts on this one? expandcollapse popup#include <GUIConstantsEx.au3> #include <WindowsConstants.au3> #include <TreeViewConstants.au3> #include <StaticConstants.au3> #include <WinAPI.au3> $gui1 = GUICreate("GUI#1", 300, 400, 100, 100) $Treeview = GUICtrlCreateTreeView(6, 6, 100, 150, BitOR($TVS_HASBUTTONS, $TVS_HASLINES, $TVS_LINESATROOT, $TVS_DISABLEDRAGDROP, $TVS_SHOWSELALWAYS), $WS_EX_CLIENTEDGE) $hTreeview = GUICtrlGetHandle($Treeview) $generalitem = GUICtrlCreateTreeViewItem("General", $Treeview) GUICtrlSetColor(-1, 0x0000C0) $displayitem = GUICtrlCreateTreeViewItem("Display", $Treeview) GUICtrlSetColor(-1, 0x0000C0) $aboutitem = GUICtrlCreateTreeViewItem("About", $generalitem) $compitem = GUICtrlCreateTreeViewItem("Computer", $generalitem) $useritem = GUICtrlCreateTreeViewItem("User", $generalitem) $resitem = GUICtrlCreateTreeViewItem("Resolution", $displayitem) $otheritem = GUICtrlCreateTreeViewItem("Other", $displayitem) $gui2 = GUICreate("GUI#2", 300, 400, 600, 100) WinSetTitle($gui1, "", $gui1) WinSetTitle($gui2, "", $gui2) GUISetState(@SW_SHOW, $gui2) GUISetState(@SW_SHOW, $gui1) GUIRegisterMsg($WM_NOTIFY, "MY_WM_NOTIFY") While 1 $msg = GUIGetMsg() If $msg = $GUI_EVENT_CLOSE Then ExitLoop WEnd GUIDelete() Func MY_WM_NOTIFY($hWnd, $msg, $wParam, $lParam) $nNotifyCode = BitShift($wParam, 16) $nID = BitAND($wParam, 0x0000FFFF) ConsoleWrite("WM_NOTIFY" & @TAB & $hWnd & @TAB & $msg & @TAB & $wParam & @TAB & $lParam & @TAB & $nID & @TAB & $nID & @CRLF) Switch WinGetHandle("[ACTIVE]", "") Case $gui1 If _WinAPI_GetAncestor($hTreeview, $GA_PARENT) <> $gui1 Then _WinAPI_SetParent($hTreeview, $gui1) GUICtrlSetPos($Treeview, 0, 0, 200, 100) EndIf Case $gui2 If _WinAPI_GetAncestor($hTreeview, $GA_PARENT) <> $gui2 Then _WinAPI_SetParent($hTreeview, $gui2) GUICtrlSetPos($Treeview, 20, 20, 200, 300) EndIf EndSwitch Return $GUI_RUNDEFMSG EndFunc ;==>MY_WM_NOTIFY OS: Win10-22H2 - 64bit - German, AutoIt Version: 3.3.16.1, AutoIt Editor: SciTE, Website: https://funk.eu AMT - Auto-Movie-Thumbnailer (2022-Nov-26) BIC - Batch-Image-Cropper (2023-Apr-01) COP - Color Picker (2009-May-21)HMW - Hide my Windows (2018-Sep-16) HRC - HotKey Resolution Changer (2012-May-16) ICU - Icon Configuration Utility (2018-Sep-16) SMF - Search my Files (2023-Jun-03) - THE file info and duplicates search tool SSD - Set Sound Device (2017-Sep-16) Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now