Sign in to follow this  
Followers 0
killerkind

Filebrowser

2 posts in this topic

#1 ·  Posted (edited)

See new Post

Edited by killerkind

Share this post


Link to post
Share on other sites



#2 ·  Posted (edited)

#Region ;**** Directives created by AutoIt3Wrapper_GUI ****
#AutoIt3Wrapper_UseX64=n
#EndRegion ;**** Directives created by AutoIt3Wrapper_GUI ****
;~Beginn Included Files
#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>
#include <TreeViewConstants.au3>
#include <GuiTreeView.au3>
#include <Array.au3>
#include <GuiListView.au3>
#include <GuiMenu.au3>
#include <GuiStatusBar.au3>
#include <ComboConstants.au3>
#include <EditConstants.au3>
#include <Timers.au3>
#include <ProgressConstants.au3>
#include <File.au3>
;~Beginn Included Files
 
;~Global variablen
Global $hTreeView, $fExpanded = 0,$fItem_select = 0,$temp_root, $idNew,$root = "C:",$files[1][4],$directorys[1][4],$dir_get_size = 0, $parent_child[1][2],$ahRoot[1][3]
$hGUI = GUICreate("Explorer", 1024, 700)
Global $htreeview = GUICtrlCreateTreeView(5, 5, 300, 670, -1)
 
$ahRoot[0][0] = _GUICtrlTreeView_InsertItem($hTreeView, $root)
$ahRoot[0][1] = 0
$ahRoot[0][2] = $root
 
 
Local $aParts[3] = [200, 150, -1]
 
$hStatusBar = _GUICtrlStatusBar_Create($hGUI, $aParts, "")
$progress = GUICtrlCreateProgress(0, 0, -1, -1, $PBS_SMOOTH)
GUICtrlSetState($progress,$GUI_HIDE)
GUICtrlSetColor($progress, 0xff0000)
_GUICtrlStatusBar_EmbedControl($hStatusBar, 0, GUICtrlGetHandle($progress))
ProgressSet ( 50)
 
GUIRegisterMsg($WM_NOTIFY, "WM_Notify_Events")
GUIRegisterMsg($WM_COMMAND, "WM_COMMAND")
GUISetState()
 
_tree_root($htreeview,$root,$ahRoot[0][0])
ControlTreeView($hGUI, "", $hTreeView, "Expand", _GUICtrlTreeView_GetText($ahRoot[0][0]))
$ahRoot[0][0] = 1
$fExpanded = 0
GUISetState()
While 1
$iMsg = GUIGetMsg()
If $fItem_select = 1 Then
ReDim $files[1]
$files[0] = ''
ReDim $directorys[1]
$directorys[0] = ''
ReDim $files[1][4]
ReDim $directorys[1][4]
$sText = _GUICtrlTreeView_GetText($hTreeView, _GUICtrlTreeView_GetSelection($hTreeView))
$fItem_select = 0
EndIf
Select
Case $iMsg = $GUI_EVENT_CLOSE
Exit
Case $fExpanded = 1
For $i = 0 To UBound($ahRoot, 1) - 1
If _GUICtrlTreeView_GetExpanded($hTreeView, $ahRoot[$i][0]) = True Then
Else
If _GUICtrlTreeView_GetExpanded($hTreeView, $ahRoot[$i][0]) = False And $ahRoot[$i][1] = 1 Then
$ahRoot[$i][1] = 0
$sText_close = _GUICtrlTreeView_GetText($hTreeView, $ahRoot[$i][0])
EndIf
EndIf
Next
$fExpanded = 0
 
Case $fExpanded = 2
GUICtrlSetState($progress,$GUI_SHOW)
For $i = 0 To UBound($ahRoot, 1) - 1
GUISetState()
If _GUICtrlTreeView_GetExpanded($hTreeView, $ahRoot[$i][0]) = True And $ahRoot[$i][1] <> 1 Then
$ahRoot[$i][1] = 1
_tree_root_test ($hTreeView,$ahRoot[$i][2],$ahRoot[$i][0])
EndIf
Next
GUICtrlSetState($progress,$GUI_HIDE)
GUICtrlSetData($progress,0)
$fExpanded = 0
EndSelect
WEnd
 
Func _tree_root ($treeview,$dir,$tree_child)
_GUICtrlTreeView_BeginUpdate($treeview)
$search = _FileListToArray($dir,"*",2)
For $i = 1 To UBound($search)-1
ReDim $ahRoot[uBound($ahRoot, 1) + 1][uBound($ahRoot, 2)]
$ahRoot[uBound($ahRoot, 1) - 1][0] = _GUICtrlTreeView_InsertItem($treeview,$search[$i],$ahRoot[0][0])
$ahRoot[uBound($ahRoot, 1) - 1][1] = 0
$ahRoot[uBound($ahRoot, 1) - 1][2] = StringReplace($root&""&$search[$i],"","")
_tree_root_child($treeview,$ahRoot[uBound($ahRoot, 1) - 1][2],$ahRoot[uBound($ahRoot, 1) - 1][0])
Next
_GUICtrlTreeView_EndUpdate($treeview)
EndFunc
 
Func _tree_root_test ($treeview,$dir,$tree_child)
_GUICtrlTreeView_BeginUpdate($treeview)
_GUICtrlTreeView_Delete($treeview ,_GUICtrlTreeView_GetFirstChild($treeview, $tree_child))
$search = _FileListToArray($dir,"*",2)
For $i = 1 To UBound($search)-1
ReDim $ahRoot[uBound($ahRoot, 1) + 1][uBound($ahRoot, 2)]
$ahRoot[uBound($ahRoot, 1) - 1][0] = _GUICtrlTreeView_InsertItem($treeview,$search[$i],$tree_child)
$ahRoot[uBound($ahRoot, 1) - 1][1] = 0
$ahRoot[uBound($ahRoot, 1) - 1][2] = StringReplace($dir&""&$search[$i],"","")
_tree_root_child($treeview,$ahRoot[uBound($ahRoot, 1) - 1][2],$ahRoot[uBound($ahRoot, 1) - 1][0])
Next
_GUICtrlTreeView_EndUpdate($treeview)
EndFunc
 
Func _tree_root_child($treeview,$dir,$tree_child)
$search = _FileListToArray($dir,"*",2)
For $i = 1 To UBound($search)-1
If UBound($search) > 1 Then
Local $child_add = _GUICtrlTreeView_InsertItem($treeview,"dummy",$tree_child)
EndIf
Return
Next
EndFunc
 
 
Func WM_Notify_Events($hWndGUI, $iMsgID, $wParam, $lParam)
#forceref $hWndGUI, $iMsgID
Local $tagNMHDR = DllStructCreate("int;int;int;int", $lParam)
If @error Then Return
Local $iEvent = DllStructGetData($tagNMHDR, 3)
Select
Case $wParam = $hTreeView
Switch $iEvent
Case $TVN_ITEMEXPANDEDW, $TVN_ITEMEXPANDEDA
$fExpanded = DllStructGetData($tagNMHDR, 4) ; 1 = node closed, 2 = node expanded
Case $WM_SETCURSOR; Das Control setzt den Cursor, weil es eine WM_SETCURSOR-Nachricht erhalten hat
MsgBox(64, "", "Item SELECT")
Case $TVN_BEGINDRAGA, $TVN_BEGINDRAGW
MsgBox(64, "", "1")
Case $TVN_BEGINLABELEDITA, $TVN_BEGINLABELEDITW
MsgBox(64, "", "2")
Case $TVN_BEGINRDRAGA, $TVN_BEGINRDRAGW
;~ MsgBox(64, "", "3")
Case $TVN_DELETEITEMA, $TVN_DELETEITEMW
;~ MsgBox(64, "", "4")
Case $TVN_ENDLABELEDITA, $TVN_ENDLABELEDITW
MsgBox(64, "", "5")
Case $TVN_GETDISPINFOA, $TVN_GETDISPINFOW
MsgBox(64, "", "6")
Case $TVN_GETINFOTIPA, $TVN_GETINFOTIPW
MsgBox(64, "", "7")
Case $TVN_ITEMEXPANDEDA, $TVN_ITEMEXPANDEDW
MsgBox(64, "", "8")
Case $TVN_ITEMEXPANDINGA, $TVN_ITEMEXPANDINGW
;~ MsgBox(64, "", "9")
Case $TVN_KEYDOWN
                  MsgBox(64,"","0")
$fItem_select = 1
Case $TVN_SELCHANGEDA, $TVN_SELCHANGEDW
;~ MsgBox(64,"","A")
$fItem_select = 1
;~ MsgBox(64,"",$fItem_select)
Case $TVN_SELCHANGINGA, $TVN_SELCHANGINGW
;~ MsgBox(64,"","B")
$fItem_select = 1
;~ MsgBox(64,"",$fItem_select)
Case $TVN_SETDISPINFOA, $TVN_SETDISPINFOW
MsgBox(64, "", "C")
EndSwitch
EndSelect
$tagNMHDR = 0
Return $GUI_RUNDEFMSG
 
EndFunc   ;==>WM_Notify_Events
 
Func WM_COMMAND($hWnd, $iMsg, $iwParam, $ilParam)
Switch _WinAPI_LoWord($iwParam)
Case $idNew
_ArrayDisplay($ahRoot)
 
EndSwitch
Return $GUI_RUNDEFMSG
EndFunc   ;==>WM_COMMAND
Edited by killerkind

Share this post


Link to post
Share on other sites

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  
Followers 0