lsakizada Posted February 20, 2011 Share Posted February 20, 2011 Yashied I forgot some code in the main while loop. here is the final one. Sorry... expandcollapse popup;; Valuater #include <GuiConstants.au3> #include <Constants.au3> #include <GUIConstantsEx.au3> #include <StaticConstants.au3> #include <TabConstants.au3> #include <WindowsConstants.au3> #include <Array.au3> #include <GuiComboBox.au3> #include "include\TVExplorer.au3" Dim $show = 0, $Child_[11], $children = 10, $ChildActual = 1 Global $Control_1[10] Global $Control_2[10] Global $Control_3[10] Global $Control_4[10] Global $Control_5[10] Global $Control_6[10] Global $Control_7[10] Global $Control_8[10] Global $Control_9[10] Global $Control_10[10] Global $hFocus = 0 $Main = GUICreate("New Link Wizard", 548, 360, (@DesktopWidth - 516) / 2, (@DesktopHeight - 323) / 2, -1, -1) $Button_1 = GUICtrlCreateButton("&Next >", 20, 150, 80, 25) $Button_2 = GUICtrlCreateButton("< &Back", 20, 120, 80, 25) $Button_3 = GUICtrlCreateButton("&Exit", 20, 300, 80, 25) GUISetState() $Child_[1] = GUICreate("", 540, 330, 0, 0, BitOR($WS_CHILD, $WS_TABSTOP) + $WS_DLGFRAME, -1, $Main) _Form_1($Control_1) GUISetState() $Child_[2] = GUICreate("", 540, 330, 0, 0, BitOR($WS_CHILD, $WS_TABSTOP) + $WS_DLGFRAME, -1, $Main) _Form_2($Control_2) GUISetState(@SW_HIDE) $Child_[3] = GUICreate("", 540, 330, 0, 0, BitOR($WS_CHILD, $WS_TABSTOP) + $WS_DLGFRAME, -1, $Main) _Form_3($Control_3) GUISetState(@SW_HIDE) $Child_[4] = GUICreate("", 540, 330, 0, 0, BitOR($WS_CHILD, $WS_TABSTOP) + $WS_DLGFRAME, -1, $Main) _Form_4($Control_4) GUISetState(@SW_HIDE) $Child_[5] = GUICreate("", 540, 330, 0, 0, BitOR($WS_CHILD, $WS_TABSTOP) + $WS_DLGFRAME, -1, $Main) _Form_5($Control_5) GUISetState(@SW_HIDE) $Child_[6] = GUICreate("", 540, 330, 0, 0, BitOR($WS_CHILD, $WS_TABSTOP) + $WS_DLGFRAME, -1, $Main) _Form_6($Control_6) GUISetState(@SW_HIDE) $Child_[7] = GUICreate("", 540, 330, 0, 0, BitOR($WS_CHILD, $WS_TABSTOP) + $WS_DLGFRAME, -1, $Main) _Form_7($Control_7) GUISetState(@SW_HIDE) $Child_[8] = GUICreate("", 540, 330, 0, 0, BitOR($WS_CHILD, $WS_TABSTOP) + $WS_DLGFRAME, -1, $Main) _Form_8($Control_8) GUISetState(@SW_HIDE) $Child_[9] = GUICreate("", 540, 330, 0, 0, BitOR($WS_CHILD, $WS_TABSTOP) + $WS_DLGFRAME, -1, $Main) _Form_9($Control_9) GUISetState(@SW_HIDE) $Child_[10] = GUICreate("", 540, 330, 0, 0, BitOR($WS_CHILD, $WS_TABSTOP) + $WS_DLGFRAME, -1, $Main) _Form_10($Control_10) GUISetState(@SW_HIDE) While 1 $msg = GUIGetMsg(1) Switch $msg[1] Case $Main Switch $msg[0] Case $GUI_EVENT_CLOSE ExitLoop Case $Button_3 ExitLoop Case $Button_1 Set_ChildSwitch(+1) Case $Button_2 Set_ChildSwitch(-1) EndSwitch Case $Child_[2] Switch $msg[0] Case $Control_2[0] $Path = _GUICtrlTVExplorer_GetSelected($hFocus) _GUICtrlTVExplorer_AttachFolder($hFocus) _GUICtrlTVExplorer_Expand($hFocus, $Path, 0) $hFocus = 0 EndSwitch EndSwitch WEnd GUIDelete($Main) ;--------- Functions ------------------- Func Set_ChildSwitch($ud) GUISetState(@SW_HIDE, $Child_[$ChildActual]) $ChildActual += $ud If $ChildActual = 11 Then $ChildActual = 1 If $ChildActual = 0 Then $ChildActual = 10 GUISetState(@SW_SHOW, $Child_[$ChildActual]) EndFunc ;==>Set_ChildSwitch Func _Form_1(ByRef $Control_1) EndFunc ;==>_Form_1 Func _Form_2(ByRef $Control_2) $Control_2[0] = _GUICtrlTVExplorer_Create(@ProgramFilesDir, 320, 48, 200, 210, -1, $WS_EX_CLIENTEDGE, -1, '_TVEvent') $Control_2[1] = GUICtrlCreateDummy() HotKeySet('{F5}', '_TVRefresh') _GUICtrlTVExplorer_Expand($Control_2[0], @ProgramFilesDir & '\AutoIt3') _GUICtrlTVExplorer_Expand($Control_2[0]) $Control_2[2] = GUICtrlCreateInput("", 320, 20, 200, 20) EndFunc ;==>_Form_2 Func _Form_3(ByRef $Control_3) EndFunc ;==>_Form_3 Func _Form_4(ByRef $Control_4) EndFunc ;==>_Form_4 Func _Form_5(ByRef $Control_5) EndFunc ;==>_Form_5 Func _Form_6(ByRef $Control_6) EndFunc ;==>_Form_6 Func _Form_7(ByRef $Control_7) EndFunc ;==>_Form_7 Func _Form_8(ByRef $Control_8) EndFunc ;==>_Form_8 Func _Form_9(ByRef $Control_9) EndFunc ;==>_Form_9 Func _Form_10(ByRef $Control_10) EndFunc ;==>_Form_10 Func _TVSetPath($iInput, $sPath) Local $Text = _WinAPI_PathCompactPath(GUICtrlGetHandle($iInput), $sPath, -2) If GUICtrlRead($iInput) <> $Text Then GUICtrlSetData($iInput, $Text) EndIf EndFunc ;==>_TVSetPath Func _TVRefresh() Local $hWnd = _WinAPI_GetFocus() If $Control_2[0] = $hWnd Then If Not $hFocus Then $hFocus = $hWnd GUICtrlSendToDummy($Control_2[1]) EndIf Return EndIf HotKeySet('{F5}') Send('{F5}') HotKeySet('{F5}', '_TVRefresh') EndFunc ;==>_TVRefresh Func _TVEvent($hWnd, $iMsg, $sPath, $hItem) Switch $iMsg Case $TV_NOTIFY_BEGINUPDATE GUISetCursor(1, 1) Case $TV_NOTIFY_ENDUPDATE GUISetCursor(2) Case $TV_NOTIFY_SELCHANGED If $Control_2[0] = $hWnd Then _TVSetPath($Control_2[2], $sPath) EndIf Case $TV_NOTIFY_DBLCLK Case $TV_NOTIFY_RCLICK ; Nothing Case $TV_NOTIFY_DELETINGITEM ; Nothing Case $TV_NOTIFY_DISKMOUNTED ; Nothing Case $TV_NOTIFY_DISKUNMOUNTED ; Nothing EndSwitch EndFunc ;==>_TVEvent Be Green Now or Never (BGNN)! Link to comment Share on other sites More sharing options...
Yashied Posted February 20, 2011 Author Share Posted February 20, 2011 (edited) Just replace GUIGetMsg(1) to _GUICtrlTVExplorer_GetMsg(1) or use OnEvent mode. I wrote about it in the first post. Edited February 20, 2011 by Yashied My UDFs: iKey | FTP Uploader | Battery Checker | Boot Manager | Font Viewer | UDF Keyword Manager | Run Dialog Replacement | USBProtect | 3D Axis | Calculator | Sleep | iSwitcher | TM | NetHelper | File Types Manager | Control Viewer | SynFolders | DLL Helper Animated Tray Icons UDF Library | Hotkeys UDF Library | Hotkeys Input Control UDF Library | Caret Shape UDF Library | Context Help UDF Library | Most Recently Used List UDF Library | Icons UDF Library | FTP UDF Library | Script Communications UDF Library | Color Chooser UDF Library | Color Picker Control UDF Library | IPHelper (Vista/7) UDF Library | WinAPI Extended UDF Library | WinAPIVhd UDF Library | Icon Chooser UDF Library | Copy UDF Library | Restart UDF Library | Event Log UDF Library | NotifyBox UDF Library | Pop-up Windows UDF Library | TVExplorer UDF Library | GuiHotKey UDF Library | GuiSysLink UDF Library | Package UDF Library | Skin UDF Library | AITray UDF Library | RDC UDF Library Appropriate path | Button text color | Gaussian random numbers | Header's styles (Vista/7) | ICON resource enumeration | Menu & INI | Tabbed string size | Tab's skin | Pop-up circular menu | Progress Bar without animation (Vista/7) | Registry export | Registry path jumping | Unique hardware ID | Windows alignment More... Link to comment Share on other sites More sharing options...
lsakizada Posted February 20, 2011 Share Posted February 20, 2011 Just replace GUIGetMsg(1) to _GUICtrlTVExplorer_GetMsg(1) or use OnEvent mode. I wrote about it in the first post. Yashied, thanks. This solve the example that I posted, however in my real application I have WM_NOTIFY function that cause the same symptom. Here is the code that is not working even after I put your correction. expandcollapse popup;; Valuater #include <GuiConstants.au3> #include <Constants.au3> #include <GUIConstantsEx.au3> #include <StaticConstants.au3> #include <TabConstants.au3> #include <WindowsConstants.au3> #include <Array.au3> #include <GuiComboBox.au3> #include "include\TVExplorer.au3" #include <GuiRichEdit.au3> Dim $show = 0, $Child_[11], $children = 10, $ChildActual = 1 Global $Control_1[10] Global $Control_2[10] Global $Control_3[10] Global $Control_4[10] Global $Control_5[10] Global $Control_6[10] Global $Control_7[10] Global $Control_8[10] Global $Control_9[10] Global $Control_10[10] Global $hFocus = 0 $Main = GUICreate("New Link Wizard", 548, 360, (@DesktopWidth - 516) / 2, (@DesktopHeight - 323) / 2, -1, -1) $Button_1 = GUICtrlCreateButton("&Next >", 20, 150, 80, 25) $Button_2 = GUICtrlCreateButton("< &Back", 20, 120, 80, 25) $Button_3 = GUICtrlCreateButton("&Exit", 20, 300, 80, 25) GUISetState() $Child_[1] = GUICreate("", 540, 330, 0, 0, BitOR($WS_CHILD, $WS_TABSTOP) + $WS_DLGFRAME, -1, $Main) _Form_1($Control_1) GUISetState() $Child_[2] = GUICreate("", 540, 330, 0, 0, BitOR($WS_CHILD, $WS_TABSTOP) + $WS_DLGFRAME, -1, $Main) _Form_2($Control_2) GUISetState(@SW_HIDE) $Child_[3] = GUICreate("", 540, 330, 0, 0, BitOR($WS_CHILD, $WS_TABSTOP) + $WS_DLGFRAME, -1, $Main) _Form_3($Control_3) GUISetState(@SW_HIDE) $Child_[4] = GUICreate("", 540, 330, 0, 0, BitOR($WS_CHILD, $WS_TABSTOP) + $WS_DLGFRAME, -1, $Main) _Form_4($Control_4) GUISetState(@SW_HIDE) $Child_[5] = GUICreate("", 540, 330, 0, 0, BitOR($WS_CHILD, $WS_TABSTOP) + $WS_DLGFRAME, -1, $Main) _Form_5($Control_5) GUISetState(@SW_HIDE) $Child_[6] = GUICreate("", 540, 330, 0, 0, BitOR($WS_CHILD, $WS_TABSTOP) + $WS_DLGFRAME, -1, $Main) _Form_6($Control_6) GUISetState(@SW_HIDE) $Child_[7] = GUICreate("", 540, 330, 0, 0, BitOR($WS_CHILD, $WS_TABSTOP) + $WS_DLGFRAME, -1, $Main) _Form_7($Control_7) GUISetState(@SW_HIDE) $Child_[8] = GUICreate("", 540, 330, 0, 0, BitOR($WS_CHILD, $WS_TABSTOP) + $WS_DLGFRAME, -1, $Main) _Form_8($Control_8) GUISetState(@SW_HIDE) $Child_[9] = GUICreate("", 540, 330, 0, 0, BitOR($WS_CHILD, $WS_TABSTOP) + $WS_DLGFRAME, -1, $Main) _Form_9($Control_9) GUISetState(@SW_HIDE) $Child_[10] = GUICreate("", 540, 330, 0, 0, BitOR($WS_CHILD, $WS_TABSTOP) + $WS_DLGFRAME, -1, $Main) _Form_10($Control_10) GUISetState(@SW_HIDE) GUIRegisterMsg($WM_NOTIFY, "WM_NOTIFY") While 1 $msg = _GUICtrlTVExplorer_GetMsg(1) Switch $msg[1] Case $Main Switch $msg[0] Case $GUI_EVENT_CLOSE ExitLoop Case $Button_3 ExitLoop Case $Button_1 Set_ChildSwitch(+1) Case $Button_2 Set_ChildSwitch(-1) EndSwitch Case $Child_[2] Switch $msg[0] Case $Control_2[0] $Path = _GUICtrlTVExplorer_GetSelected($hFocus) _GUICtrlTVExplorer_AttachFolder($hFocus) _GUICtrlTVExplorer_Expand($hFocus, $Path, 0) $hFocus = 0 EndSwitch EndSwitch WEnd GUIDelete($Main) ;--------- Functions ------------------- Func Set_ChildSwitch($ud) GUISetState(@SW_HIDE, $Child_[$ChildActual]) $ChildActual += $ud If $ChildActual = 11 Then $ChildActual = 1 If $ChildActual = 0 Then $ChildActual = 10 GUISetState(@SW_SHOW, $Child_[$ChildActual]) EndFunc ;==>Set_ChildSwitch Func _Form_1(ByRef $Control_1) $Control_1[0] = GuiCtrlCreateButton("Button",20,20,40,22) EndFunc ;==>_Form_1 Func _Form_2(ByRef $Control_2) $Control_2[0] = _GUICtrlTVExplorer_Create(@ProgramFilesDir, 320, 48, 200, 210, -1, $WS_EX_CLIENTEDGE, -1, '_TVEvent') $Control_2[1] = GUICtrlCreateDummy() HotKeySet('{F5}', '_TVRefresh') _GUICtrlTVExplorer_Expand($Control_2[0], @ProgramFilesDir & '\AutoIt3') _GUICtrlTVExplorer_Expand($Control_2[0]) $Control_2[2] = GUICtrlCreateInput("", 320, 20, 200, 20) EndFunc ;==>_Form_2 Func _Form_3(ByRef $Control_3) EndFunc ;==>_Form_3 Func _Form_4(ByRef $Control_4) EndFunc ;==>_Form_4 Func _Form_5(ByRef $Control_5) EndFunc ;==>_Form_5 Func _Form_6(ByRef $Control_6) EndFunc ;==>_Form_6 Func _Form_7(ByRef $Control_7) EndFunc ;==>_Form_7 Func _Form_8(ByRef $Control_8) EndFunc ;==>_Form_8 Func _Form_9(ByRef $Control_9) EndFunc ;==>_Form_9 Func _Form_10(ByRef $Control_10) EndFunc ;==>_Form_10 Func _TVSetPath($iInput, $sPath) Local $Text = _WinAPI_PathCompactPath(GUICtrlGetHandle($iInput), $sPath, -2) If GUICtrlRead($iInput) <> $Text Then GUICtrlSetData($iInput, $Text) EndIf EndFunc ;==>_TVSetPath Func _TVRefresh() Local $hWnd = _WinAPI_GetFocus() If $Control_2[0] = $hWnd Then If Not $hFocus Then $hFocus = $hWnd GUICtrlSendToDummy($Control_2[1]) EndIf Return EndIf HotKeySet('{F5}') Send('{F5}') HotKeySet('{F5}', '_TVRefresh') EndFunc ;==>_TVRefresh Func _TVEvent($hWnd, $iMsg, $sPath, $hItem) Switch $iMsg Case $TV_NOTIFY_BEGINUPDATE GUISetCursor(1, 1) Case $TV_NOTIFY_ENDUPDATE GUISetCursor(2) Case $TV_NOTIFY_SELCHANGED If $Control_2[0] = $hWnd Then _TVSetPath($Control_2[2], $sPath) EndIf Case $TV_NOTIFY_DBLCLK Case $TV_NOTIFY_RCLICK ; Nothing Case $TV_NOTIFY_DELETINGITEM ; Nothing Case $TV_NOTIFY_DISKMOUNTED ; Nothing Case $TV_NOTIFY_DISKUNMOUNTED ; Nothing EndSwitch EndFunc ;==>_TVEvent Func WM_NOTIFY($hWnd, $iMsg, $iWparam, $iLparam) #forceref $iMsg, $iWparam Local $hWndFrom, $iCode, $tNMHDR, $tMsgFilter, $hMenu $tNMHDR = DllStructCreate($tagNMHDR, $iLparam) $hWndFrom = HWnd(DllStructGetData($tNMHDR, "hWndFrom")) $iCode = DllStructGetData($tNMHDR, "Code") Switch $hWndFrom Case $Control_1[0] Select Case $iCode = $EN_MSGFILTER $tMsgFilter = DllStructCreate($tagEN_MSGFILTER, $iLparam) If DllStructGetData($tMsgFilter, "msg") = $WM_RBUTTONUP Then ; $hMenu = GUICtrlGetHandle($Control_2[21]) ; SetMenuTexts($hWndFrom, $hMenu) ; _GUICtrlMenu_TrackPopupMenu($hMenu, $hWnd) EndIf EndSelect EndSwitch Return $GUI_RUNDEFMSG EndFunc ;==>WM_NOTIFY Be Green Now or Never (BGNN)! Link to comment Share on other sites More sharing options...
Yashied Posted February 21, 2011 Author Share Posted February 21, 2011 Func WM_NOTIFY($hWnd, $iMsg, $iWparam, $iLparam) #forceref $iMsg, $iWparam ; VERY IMPORTANT!!! TV_WM_NOTIFY($hWnd, $iMsg, $iWparam, $iLparam) Local $hWndFrom, $iCode, $tNMHDR, $tMsgFilter, $hMenu $tNMHDR = DllStructCreate($tagNMHDR, $iLparam) $hWndFrom = HWnd(DllStructGetData($tNMHDR, "hWndFrom")) $iCode = DllStructGetData($tNMHDR, "Code") Switch $hWndFrom Case $Control_1[0] Select Case $iCode = $EN_MSGFILTER $tMsgFilter = DllStructCreate($tagEN_MSGFILTER, $iLparam) If DllStructGetData($tMsgFilter, "msg") = $WM_RBUTTONUP Then ; $hMenu = GUICtrlGetHandle($Control_2[21]) ; SetMenuTexts($hWndFrom, $hMenu) ; _GUICtrlMenu_TrackPopupMenu($hMenu, $hWnd) EndIf EndSelect EndSwitch Return $GUI_RUNDEFMSG EndFunc ;==>WM_NOTIFY My UDFs: iKey | FTP Uploader | Battery Checker | Boot Manager | Font Viewer | UDF Keyword Manager | Run Dialog Replacement | USBProtect | 3D Axis | Calculator | Sleep | iSwitcher | TM | NetHelper | File Types Manager | Control Viewer | SynFolders | DLL Helper Animated Tray Icons UDF Library | Hotkeys UDF Library | Hotkeys Input Control UDF Library | Caret Shape UDF Library | Context Help UDF Library | Most Recently Used List UDF Library | Icons UDF Library | FTP UDF Library | Script Communications UDF Library | Color Chooser UDF Library | Color Picker Control UDF Library | IPHelper (Vista/7) UDF Library | WinAPI Extended UDF Library | WinAPIVhd UDF Library | Icon Chooser UDF Library | Copy UDF Library | Restart UDF Library | Event Log UDF Library | NotifyBox UDF Library | Pop-up Windows UDF Library | TVExplorer UDF Library | GuiHotKey UDF Library | GuiSysLink UDF Library | Package UDF Library | Skin UDF Library | AITray UDF Library | RDC UDF Library Appropriate path | Button text color | Gaussian random numbers | Header's styles (Vista/7) | ICON resource enumeration | Menu & INI | Tabbed string size | Tab's skin | Pop-up circular menu | Progress Bar without animation (Vista/7) | Registry export | Registry path jumping | Unique hardware ID | Windows alignment More... Link to comment Share on other sites More sharing options...
lsakizada Posted February 21, 2011 Share Posted February 21, 2011 Func WM_NOTIFY($hWnd, $iMsg, $iWparam, $iLparam) #forceref $iMsg, $iWparam ; VERY IMPORTANT!!! TV_WM_NOTIFY($hWnd, $iMsg, $iWparam, $iLparam) Local $hWndFrom, $iCode, $tNMHDR, $tMsgFilter, $hMenu $tNMHDR = DllStructCreate($tagNMHDR, $iLparam) $hWndFrom = HWnd(DllStructGetData($tNMHDR, "hWndFrom")) $iCode = DllStructGetData($tNMHDR, "Code") Switch $hWndFrom Case $Control_1[0] Select Case $iCode = $EN_MSGFILTER $tMsgFilter = DllStructCreate($tagEN_MSGFILTER, $iLparam) If DllStructGetData($tMsgFilter, "msg") = $WM_RBUTTONUP Then ; $hMenu = GUICtrlGetHandle($Control_2[21]) ; SetMenuTexts($hWndFrom, $hMenu) ; _GUICtrlMenu_TrackPopupMenu($hMenu, $hWnd) EndIf EndSelect EndSwitch Return $GUI_RUNDEFMSG EndFunc ;==>WM_NOTIFY Hi Yashied. Billions of billions thanks For sharing and support! Its took me a one night until I noticed your comment inside the WM_NOTIFY. ; VERY IMPORTANT!!! TV_WM_NOTIFY($hWnd, $iMsg, $iWparam, $iLparam) Be Green Now or Never (BGNN)! Link to comment Share on other sites More sharing options...
lsakizada Posted February 21, 2011 Share Posted February 21, 2011 Yashied,This is nice mode and I realy like it and I am gona use it in my application.Until now I tested it on Win XP SP3, windows 2003 and windows 2008 all systems 64 BIT and its worked fine.A little issue I saw is that when using a background picture utilizing GUICtrlCreatePic() under the control then sometimes but not always, when the tree collapsed the picture overlapped the control.I disabled the GUICtrlCreatePic control and set the TVExplorer control on top but nothing helped.Like this:GUICtrlCreatePic("img_bg.bmp", 0, 0, 700, 736) GUICtrlSetState(-1, $GUI_DISABLE) GUICtrlSetState($hTV[0], $GUI_FOCUS) Be Green Now or Never (BGNN)! Link to comment Share on other sites More sharing options...
Yashied Posted February 21, 2011 Author Share Posted February 21, 2011 TVExplorer is not different from the TreeView. I can not say what your problem is. My UDFs: iKey | FTP Uploader | Battery Checker | Boot Manager | Font Viewer | UDF Keyword Manager | Run Dialog Replacement | USBProtect | 3D Axis | Calculator | Sleep | iSwitcher | TM | NetHelper | File Types Manager | Control Viewer | SynFolders | DLL Helper Animated Tray Icons UDF Library | Hotkeys UDF Library | Hotkeys Input Control UDF Library | Caret Shape UDF Library | Context Help UDF Library | Most Recently Used List UDF Library | Icons UDF Library | FTP UDF Library | Script Communications UDF Library | Color Chooser UDF Library | Color Picker Control UDF Library | IPHelper (Vista/7) UDF Library | WinAPI Extended UDF Library | WinAPIVhd UDF Library | Icon Chooser UDF Library | Copy UDF Library | Restart UDF Library | Event Log UDF Library | NotifyBox UDF Library | Pop-up Windows UDF Library | TVExplorer UDF Library | GuiHotKey UDF Library | GuiSysLink UDF Library | Package UDF Library | Skin UDF Library | AITray UDF Library | RDC UDF Library Appropriate path | Button text color | Gaussian random numbers | Header's styles (Vista/7) | ICON resource enumeration | Menu & INI | Tabbed string size | Tab's skin | Pop-up circular menu | Progress Bar without animation (Vista/7) | Registry export | Registry path jumping | Unique hardware ID | Windows alignment More... Link to comment Share on other sites More sharing options...
lsakizada Posted February 22, 2011 Share Posted February 22, 2011 (edited) I have one more question please. Is it possible to set a different root folder in the control after creating the control? Something like detaching the tree and creating it with new root. EDIT: ActuallyI found how to do it with simple case. _GUICtrlTreeView_Delete($hTV, 0) GUICtrlTVExplorer_AttachFolder ( hTV , $sPath) Edited February 23, 2011 by lsakizada Be Green Now or Never (BGNN)! Link to comment Share on other sites More sharing options...
4wd Posted February 23, 2011 Share Posted February 23, 2011 Thanks Yashied for an excellent UDF, I've been sitting here wondering how to get two TreeViews into one GUI and next thing I know...problem solved.Except I'm having a hard time just displaying a Directory Tree, I assume $TV_FLAG_DIRTREE is the flag I want but it seems to only display some directories and not others.The code is basically the example with all the parts I didn't need stripped out.expandcollapse popup#Region ;**** Directives created by AutoIt3Wrapper_GUI **** #AutoIt3Wrapper_UseUpx=n #AutoIt3Wrapper_UseX64=n #EndRegion ;**** Directives created by AutoIt3Wrapper_GUI **** #Include <GUIConstantsEx.au3> #Include <GUITreeView.au3> #Include <TVExplorer.au3> #Include <TreeViewConstants.au3> #Include <WindowsConstants.au3> #Include <WinAPIEx.au3> Opt('MustDeclareVars', 1) Global $hForm, $hTV[3], $Input[3], $hFocus = 0, $Dummy, $Path, $Style If Not _WinAPI_DwmIsCompositionEnabled() Then $Style = $WS_EX_COMPOSITED Else $Style = -1 EndIf $hForm = GUICreate('TVExplorer UDF Example', 700, 340, -1, -1, BitOR($GUI_SS_DEFAULT_GUI, $WS_MAXIMIZEBOX, $WS_SIZEBOX), $Style) GUISetIcon(@WindowsDir & '\explorer.exe') $hTV[0] = _GUICtrlTVExplorer_Create('', 20, 20, 320, 310, -1, $WS_EX_CLIENTEDGE, $TV_FLAG_DIRTREE, '_TVEvent') $hTV[1] = _GUICtrlTVExplorer_Create('', 360, 20, 320, 310, -1, $WS_EX_CLIENTEDGE, $TV_FLAG_DEFAULT, '_TVEvent') For $i = 0 To 1 _TVSetPath($Input[$i], _GUICtrlTVExplorer_GetSelected($hTV[$i])) _GUICtrlTVExplorer_SetExplorerStyle($hTV[$i]) Next $Dummy = GUICtrlCreateDummy() GUISetState() While 1 Switch _GUICtrlTVExplorer_GetMsg() Case $GUI_EVENT_CLOSE GUIDelete() _GUICtrlTVExplorer_DestroyAll() Exit Case $Dummy $Path = _GUICtrlTVExplorer_GetSelected($hFocus) _GUICtrlTVExplorer_AttachFolder($hFocus) _GUICtrlTVExplorer_Expand($hFocus, $Path, 0) $hFocus = 0 EndSwitch WEnd Func _TVEvent($hWnd, $iMsg, $sPath, $hItem) Switch $iMsg Case $TV_NOTIFY_BEGINUPDATE GUISetCursor(1, 1) Case $TV_NOTIFY_ENDUPDATE GUISetCursor(2) Case $TV_NOTIFY_SELCHANGED For $i = 0 To 2 If $hTV[$i] = $hWnd Then _TVSetPath($Input[$i], $sPath) ExitLoop EndIf Next Case $TV_NOTIFY_DBLCLK ; Nothing Case $TV_NOTIFY_RCLICK ; Nothing Case $TV_NOTIFY_DELETINGITEM ; Nothing Case $TV_NOTIFY_DISKMOUNTED ; Nothing Case $TV_NOTIFY_DISKUNMOUNTED ; Nothing EndSwitch EndFunc ;==>_TVEvent Func _TVSetPath($iInput, $sPath) Local $Text = _WinAPI_PathCompactPath(GUICtrlGetHandle($iInput), $sPath, -2) If GUICtrlRead($iInput) <> $Text Then GUICtrlSetData($iInput, $Text) EndIf EndFunc ;==>_TVSetPathWhat I'd like is the directory tree as per the tree view on the right without files but I can't seem to get it using various combinations of the $TV_FLAG_SHOW* flags.While I'm using Win7 x64 on my main computer, it also seems to do it on XP Pro SP3 computers I have. It's not just that particular media, (flash drive), either it happens across all my hard drives, ie. some directory structures are there and some don't expand even though I know they go 1 or more levels deep.So any help getting just a directory tree view that displays all (sub-)directories would be much appreciated.TVExplorer v1.1WinAPIEx v3.2AutoIt v3.3.6.1Thank you again for a really good UDF. Link to comment Share on other sites More sharing options...
Yashied Posted February 23, 2011 Author Share Posted February 23, 2011 Thank you for your feedback. This is my carelessness... Fixed. Please download a new version. My UDFs: iKey | FTP Uploader | Battery Checker | Boot Manager | Font Viewer | UDF Keyword Manager | Run Dialog Replacement | USBProtect | 3D Axis | Calculator | Sleep | iSwitcher | TM | NetHelper | File Types Manager | Control Viewer | SynFolders | DLL Helper Animated Tray Icons UDF Library | Hotkeys UDF Library | Hotkeys Input Control UDF Library | Caret Shape UDF Library | Context Help UDF Library | Most Recently Used List UDF Library | Icons UDF Library | FTP UDF Library | Script Communications UDF Library | Color Chooser UDF Library | Color Picker Control UDF Library | IPHelper (Vista/7) UDF Library | WinAPI Extended UDF Library | WinAPIVhd UDF Library | Icon Chooser UDF Library | Copy UDF Library | Restart UDF Library | Event Log UDF Library | NotifyBox UDF Library | Pop-up Windows UDF Library | TVExplorer UDF Library | GuiHotKey UDF Library | GuiSysLink UDF Library | Package UDF Library | Skin UDF Library | AITray UDF Library | RDC UDF Library Appropriate path | Button text color | Gaussian random numbers | Header's styles (Vista/7) | ICON resource enumeration | Menu & INI | Tabbed string size | Tab's skin | Pop-up circular menu | Progress Bar without animation (Vista/7) | Registry export | Registry path jumping | Unique hardware ID | Windows alignment More... Link to comment Share on other sites More sharing options...
4wd Posted February 23, 2011 Share Posted February 23, 2011 Thanks Yashied, works great now. Link to comment Share on other sites More sharing options...
lsakizada Posted March 2, 2011 Share Posted March 2, 2011 (edited) Yashied,Is it a possible to extract the code from the UDF to get the file's associated icon?I have been looking around and most of the code that I have seen in the forums was not detected all icons associated with the files on my system.Apparently that your code is doing it properly.BTW: I realy like your coding.Regards!EDIT: OOOPSS: I just so this link and its works for me. Edited March 2, 2011 by lsakizada Be Green Now or Never (BGNN)! Link to comment Share on other sites More sharing options...
Yashied Posted March 2, 2011 Author Share Posted March 2, 2011 Look at the example for _WinAPI_ShellExtractAssociatedIcon() function from library. My UDFs: iKey | FTP Uploader | Battery Checker | Boot Manager | Font Viewer | UDF Keyword Manager | Run Dialog Replacement | USBProtect | 3D Axis | Calculator | Sleep | iSwitcher | TM | NetHelper | File Types Manager | Control Viewer | SynFolders | DLL Helper Animated Tray Icons UDF Library | Hotkeys UDF Library | Hotkeys Input Control UDF Library | Caret Shape UDF Library | Context Help UDF Library | Most Recently Used List UDF Library | Icons UDF Library | FTP UDF Library | Script Communications UDF Library | Color Chooser UDF Library | Color Picker Control UDF Library | IPHelper (Vista/7) UDF Library | WinAPI Extended UDF Library | WinAPIVhd UDF Library | Icon Chooser UDF Library | Copy UDF Library | Restart UDF Library | Event Log UDF Library | NotifyBox UDF Library | Pop-up Windows UDF Library | TVExplorer UDF Library | GuiHotKey UDF Library | GuiSysLink UDF Library | Package UDF Library | Skin UDF Library | AITray UDF Library | RDC UDF Library Appropriate path | Button text color | Gaussian random numbers | Header's styles (Vista/7) | ICON resource enumeration | Menu & INI | Tabbed string size | Tab's skin | Pop-up circular menu | Progress Bar without animation (Vista/7) | Registry export | Registry path jumping | Unique hardware ID | Windows alignment More... Link to comment Share on other sites More sharing options...
qwert Posted March 2, 2011 Share Posted March 2, 2011 Yasheid, I had posted a question a couple of weeks ago on the thread about On The Fly TreeViews in the hope that you would see it. But Melba23 suggested that I might want to bring it up on this active thread ... so, my question was this:I've explored the examples you pointed to and also explored the tree view examples in help. I quickly found that I was reading too much "directory tree" into the purpose and functions of tree views. ... But before I abandon my idea, I wanted to show exactly what I was trying for and ask: is this impossible in a simple script?Can you suggest a way? I seems to me that many would find this enhanced "on the fly" view useful. Link to comment Share on other sites More sharing options...
Yashied Posted March 2, 2011 Author Share Posted March 2, 2011 (edited) Is this possible in a simple script?No. Only in a ListView. Edited March 2, 2011 by Yashied My UDFs: iKey | FTP Uploader | Battery Checker | Boot Manager | Font Viewer | UDF Keyword Manager | Run Dialog Replacement | USBProtect | 3D Axis | Calculator | Sleep | iSwitcher | TM | NetHelper | File Types Manager | Control Viewer | SynFolders | DLL Helper Animated Tray Icons UDF Library | Hotkeys UDF Library | Hotkeys Input Control UDF Library | Caret Shape UDF Library | Context Help UDF Library | Most Recently Used List UDF Library | Icons UDF Library | FTP UDF Library | Script Communications UDF Library | Color Chooser UDF Library | Color Picker Control UDF Library | IPHelper (Vista/7) UDF Library | WinAPI Extended UDF Library | WinAPIVhd UDF Library | Icon Chooser UDF Library | Copy UDF Library | Restart UDF Library | Event Log UDF Library | NotifyBox UDF Library | Pop-up Windows UDF Library | TVExplorer UDF Library | GuiHotKey UDF Library | GuiSysLink UDF Library | Package UDF Library | Skin UDF Library | AITray UDF Library | RDC UDF Library Appropriate path | Button text color | Gaussian random numbers | Header's styles (Vista/7) | ICON resource enumeration | Menu & INI | Tabbed string size | Tab's skin | Pop-up circular menu | Progress Bar without animation (Vista/7) | Registry export | Registry path jumping | Unique hardware ID | Windows alignment More... Link to comment Share on other sites More sharing options...
lsakizada Posted March 2, 2011 Share Posted March 2, 2011 Look at the example for _WinAPI_ShellExtractAssociatedIcon() function from library.Yashied, thank you very much. I learn the example and implemented it into my application.Just one thing notice that some icons are displayed properly with your TVExplorer control while the example could not display it well.for example the link extension (.lnk) display as the windows not found icon.cheers! Be Green Now or Never (BGNN)! Link to comment Share on other sites More sharing options...
Yashied Posted March 3, 2011 Author Share Posted March 3, 2011 If you specify just ".lnk" extension, of course the icons will not be (nowhere to take). But if you specify the full path to the ".lnk" file, everything will be OK. My UDFs: iKey | FTP Uploader | Battery Checker | Boot Manager | Font Viewer | UDF Keyword Manager | Run Dialog Replacement | USBProtect | 3D Axis | Calculator | Sleep | iSwitcher | TM | NetHelper | File Types Manager | Control Viewer | SynFolders | DLL Helper Animated Tray Icons UDF Library | Hotkeys UDF Library | Hotkeys Input Control UDF Library | Caret Shape UDF Library | Context Help UDF Library | Most Recently Used List UDF Library | Icons UDF Library | FTP UDF Library | Script Communications UDF Library | Color Chooser UDF Library | Color Picker Control UDF Library | IPHelper (Vista/7) UDF Library | WinAPI Extended UDF Library | WinAPIVhd UDF Library | Icon Chooser UDF Library | Copy UDF Library | Restart UDF Library | Event Log UDF Library | NotifyBox UDF Library | Pop-up Windows UDF Library | TVExplorer UDF Library | GuiHotKey UDF Library | GuiSysLink UDF Library | Package UDF Library | Skin UDF Library | AITray UDF Library | RDC UDF Library Appropriate path | Button text color | Gaussian random numbers | Header's styles (Vista/7) | ICON resource enumeration | Menu & INI | Tabbed string size | Tab's skin | Pop-up circular menu | Progress Bar without animation (Vista/7) | Registry export | Registry path jumping | Unique hardware ID | Windows alignment More... Link to comment Share on other sites More sharing options...
lsakizada Posted March 3, 2011 Share Posted March 3, 2011 If you specify just ".lnk" extension, of course the icons will not be (nowhere to take). But if you specify the full path to the ".lnk" file, everything will be OK. I specify a full path and the example are also using full path to the .ink icon. So i guess its not the issue. Yashied. I have just ran the example on win 2008. The tree item were unable to be expand and some icons shown on the screen are black. See the picture. http://img145.imageshack.us/i/tvexpwin2008.jpg Be Green Now or Never (BGNN)! Link to comment Share on other sites More sharing options...
Yashied Posted March 3, 2011 Author Share Posted March 3, 2011 You are using 16-bit color depth? OK, replace the _WinAPI_AddIconTransparency() function in WinAPIEx.au3 or wait until I update it. Thanks. expandcollapse popupFunc _WinAPI_AddIconTransparency($hIcon, $iPercent = 50, $fDelete = 0) Local $tICONINFO, $tBIHDR, $tBITMAP, $W, $H, $Ret, $iByte, $tBits, $pBits, $hResult = 0 Local $hBitmap[2] $tICONINFO = DllStructCreate($tagICONINFO) $Ret = DllCall('user32.dll', 'int', 'GetIconInfo', 'ptr', $hIcon, 'ptr', DllStructGetPtr($tICONINFO)) If (@error) Or (Not $Ret[0]) Then Return SetError(1, 0, 0) EndIf For $i = 0 To 1 $hBitmap[$i] = DllStructGetData($tICONINFO, $i + 4) Next Do $tBITMAP = DllStructCreate($tagBITMAP) If Not _WinAPI_GetObject($hBitmap[1], DllStructGetSize($tBITMAP), DllStructGetPtr($tBITMAP)) Then ExitLoop EndIf $W = DllStructGetData($tBITMAP, 'bmWidth') $H = DllStructGetData($tBITMAP, 'bmHeight') $iByte = $W * $H * 4 $tBits = DllStructCreate('byte[' & $iByte & ']') $pBits = DllStructGetPtr($tBits) If _WinAPI_GetBitmapBits($hBitmap[1], $iByte, $pBits) <> $iByte Then ExitLoop EndIf For $i = 1 To $iByte Step 4 DllStructSetData($tBits, 1, DllStructGetData($tBits, 1, $i + 3) * $iPercent / 100, $i + 3) Next _WinAPI_DeleteObject($hBitmap[1]) $tBIHDR = DllStructCreate($tagBITMAPINFOHEADER) DllStructSetData($tBIHDR, 'biSize', DllStructGetSize($tBIHDR)) DllStructSetData($tBIHDR, 'biWidth', $W) DllStructSetData($tBIHDR, 'biHeight', $H) DllStructSetData($tBIHDR, 'biPlanes', 1) DllStructSetData($tBIHDR, 'biBitCount', 32) DllStructSetData($tBIHDR, 'biCompression', $BI_RGB) $hBitmap[1] = _WinAPI_CreateDIBSection(0, $tBIHDR, $DIB_RGB_COLORS, $Ret) If @error Then ExitLoop EndIf If _WinAPI_SetBitmapBits($hBitmap[1], $iByte, $pBits) <> $iByte Then ExitLoop EndIf $hResult = _WinAPI_CreateIconIndirect($hBitmap[1], $hBitmap[0]) Until 1 For $i = 0 To 1 If $hBitmap[$i] Then _WinAPI_DeleteObject($hBitmap[$i]) EndIf Next If Not $hResult Then Return SetError(1, 0, 0) EndIf If $fDelete Then _WinAPI_DestroyIcon($hIcon) EndIf Return $hResult EndFunc ;==>_WinAPI_AddIconTransparency My UDFs: iKey | FTP Uploader | Battery Checker | Boot Manager | Font Viewer | UDF Keyword Manager | Run Dialog Replacement | USBProtect | 3D Axis | Calculator | Sleep | iSwitcher | TM | NetHelper | File Types Manager | Control Viewer | SynFolders | DLL Helper Animated Tray Icons UDF Library | Hotkeys UDF Library | Hotkeys Input Control UDF Library | Caret Shape UDF Library | Context Help UDF Library | Most Recently Used List UDF Library | Icons UDF Library | FTP UDF Library | Script Communications UDF Library | Color Chooser UDF Library | Color Picker Control UDF Library | IPHelper (Vista/7) UDF Library | WinAPI Extended UDF Library | WinAPIVhd UDF Library | Icon Chooser UDF Library | Copy UDF Library | Restart UDF Library | Event Log UDF Library | NotifyBox UDF Library | Pop-up Windows UDF Library | TVExplorer UDF Library | GuiHotKey UDF Library | GuiSysLink UDF Library | Package UDF Library | Skin UDF Library | AITray UDF Library | RDC UDF Library Appropriate path | Button text color | Gaussian random numbers | Header's styles (Vista/7) | ICON resource enumeration | Menu & INI | Tabbed string size | Tab's skin | Pop-up circular menu | Progress Bar without animation (Vista/7) | Registry export | Registry path jumping | Unique hardware ID | Windows alignment More... Link to comment Share on other sites More sharing options...
lsakizada Posted March 3, 2011 Share Posted March 3, 2011 (edited) You are using 16-bit color depth? OK, replace the _WinAPI_AddIconTransparency() function in WinAPIEx.au3 or wait until I update it. Thanks. expandcollapse popupFunc _WinAPI_AddIconTransparency($hIcon, $iPercent = 50, $fDelete = 0) Local $tICONINFO, $tBIHDR, $tBITMAP, $W, $H, $Ret, $iByte, $tBits, $pBits, $hResult = 0 Local $hBitmap[2] $tICONINFO = DllStructCreate($tagICONINFO) $Ret = DllCall('user32.dll', 'int', 'GetIconInfo', 'ptr', $hIcon, 'ptr', DllStructGetPtr($tICONINFO)) If (@error) Or (Not $Ret[0]) Then Return SetError(1, 0, 0) EndIf For $i = 0 To 1 $hBitmap[$i] = DllStructGetData($tICONINFO, $i + 4) Next Do $tBITMAP = DllStructCreate($tagBITMAP) If Not _WinAPI_GetObject($hBitmap[1], DllStructGetSize($tBITMAP), DllStructGetPtr($tBITMAP)) Then ExitLoop EndIf $W = DllStructGetData($tBITMAP, 'bmWidth') $H = DllStructGetData($tBITMAP, 'bmHeight') $iByte = $W * $H * 4 $tBits = DllStructCreate('byte[' & $iByte & ']') $pBits = DllStructGetPtr($tBits) If _WinAPI_GetBitmapBits($hBitmap[1], $iByte, $pBits) <> $iByte Then ExitLoop EndIf For $i = 1 To $iByte Step 4 DllStructSetData($tBits, 1, DllStructGetData($tBits, 1, $i + 3) * $iPercent / 100, $i + 3) Next _WinAPI_DeleteObject($hBitmap[1]) $tBIHDR = DllStructCreate($tagBITMAPINFOHEADER) DllStructSetData($tBIHDR, 'biSize', DllStructGetSize($tBIHDR)) DllStructSetData($tBIHDR, 'biWidth', $W) DllStructSetData($tBIHDR, 'biHeight', $H) DllStructSetData($tBIHDR, 'biPlanes', 1) DllStructSetData($tBIHDR, 'biBitCount', 32) DllStructSetData($tBIHDR, 'biCompression', $BI_RGB) $hBitmap[1] = _WinAPI_CreateDIBSection(0, $tBIHDR, $DIB_RGB_COLORS, $Ret) If @error Then ExitLoop EndIf If _WinAPI_SetBitmapBits($hBitmap[1], $iByte, $pBits) <> $iByte Then ExitLoop EndIf $hResult = _WinAPI_CreateIconIndirect($hBitmap[1], $hBitmap[0]) Until 1 For $i = 0 To 1 If $hBitmap[$i] Then _WinAPI_DeleteObject($hBitmap[$i]) EndIf Next If Not $hResult Then Return SetError(1, 0, 0) EndIf If $fDelete Then _WinAPI_DestroyIcon($hIcon) EndIf Return $hResult EndFunc ;==>_WinAPI_AddIconTransparency Cool! its working now with 16 and 32 BIT color. At the beginning I thought its about the OS, now I am happy that I do not have to revert the code (just kidding). Let me know If you need me to retest it on any combination that you would use it. I have almost anything at work. Edited March 3, 2011 by lsakizada Be Green Now or Never (BGNN)! 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