Sign in to follow this  
Followers 0
rodent1

unable to control a treeview under windows 8 64

9 posts in this topic

#1 ·  Posted (edited)

I need to take control of printer option selections in a treeview, and make selections. It works fine in XP, windows 2008, vista, windows 7. But not under windows 8 64 bits.

Here is what I've tried.

First, to bring up the window with the treeview,

1- start Notepad.

2- Press ctrl P to bring up the print dialog.

3- Select the "Microsoft XPS Document Writer" printer. I need to make this work on other printers, but this one is a good example, and should be present on any machine.

4- click on the Preferences button. This displays the Printing Preferences dialog.

5- click on Advanced.... This displays the "Microsoft XPS Document Writer v4 Advanced Options" dialog. In has a treeview. It is viewed by the autoit window tool as a SysTreeView32 class instance.

Coding attempts:

Local $hwndTV = ControlGetHandle("Microsoft XPS Document Writer v4 Advanced Options", "", "[Class:SysTreeView32; INSTANCE=1]") ; this succeeds and populates $hndTV
; try to find the root node
Local $ItemHnd = _GuiCtrlTreeView_FindItemEx($hwndTV, "Microsoft XPS Document Writer v4 Advanced Document Settings") ; this fails and returns a "0" handle
; try to get the handle of the first item
Local $FirstItemHnd = _GuiCtrlTreeView_GetFirstItem($hwndTV) ; this succeeds
; try to get the text of the first item
msgbox(0,"","_GUICtrlTreeView_GetText($hwndTV, $hStart) ; this fails and returns an empty string, so that I can't step through entries looking for text
; try to use ControlTreeView Commands
msgbox(0,"",ControltreeView("Microsoft XPS Document Writer v4 Advanced Options", "", "[Class:SysTreeView32; INSTANCE=1]", "Exists", "#0") ; this returns 1: it can see the root node
;check if it sees children of the root node

msgbox(0,"",ControltreeView("Microsoft XPS Document Writer v4 Advanced Options", "", "[Class:SysTreeView32; INSTANCE=1]", "Exists", "#0|#0") ; this returns 0: it only sees a root node. This means that I can't navigate and find nodes, much less select them and make selections.

I would appreciate other ideas to make those selections using AutoIT.

Thanks!

Edited by rodent1

Share this post


Link to post
Share on other sites



The _GuiCtrlTreeView_GetText statement is what fails.

I went to the sub in GuiTreeView.au3, and checked return values where possible. There is no error, DllStructGetData($tText,"Buffer") just returns an empty string for each treeview item, so that I can't find the item I need AutoIt to update.

The problem has migrated to Windows 7, so that I think Microsoft has come up with a new version of the treeview for the print advanced options dialog, and so far my attempts at using AutoIT to read it have failed.

Share this post


Link to post
Share on other sites

in case someone faces the same problem, I came up with a solution. It's a work-around, it doesn't fix the problem where autoit doesn't get the node text from Windows. I noticed that the window hidden text contains the current treeview selection, if any. So I select each tree node, record the hidden text, and generate a map of the treeview, so that I then know what node to select.

If someone comes up with a better method to do this, I'm all ears etc.

Here is the code:

Dim $TVTreeList ; map to contain treeview node info
;$hwndTV is the treeview handle, $Fin is the print finishing I need to select, one of the treeview node text values.
Func TVSelect($hwndTV, $Fin)
Local $WinTitle = WinGetTitle($hwndTV)
;this is used repeatedly in 100s of tests, so I just build the map once and reuse it. The map is in $TVTreeList
if StringLen($TVTreeList)=0 Then
  TVGenTreeList($hwndTV, $WinTitle)
EndIf
; the map entries are CRLF-spearated, and consist of a node path followed by "" and the node text
if StringInStr($TVTreeList, "" & $Fin & ": " & @CRLF) > 0 Then
; split the map into an array of lines
  Local $arData = StringSplit($TVTreeList, @CRLF, 1)
; browse through all lines looking for the string with correct text, $Fin
  for $i = 1 to $arData[0]
   if StringRight($arData[$i], stringlen($Fin)+3) = "" & $Fin & ": " Then
; if I find it, select it. This will cause a combobox to appear for the selected value, but this is done elsewhere.
    ControlTreeView($WinTitle, "", $hwndTV, "Select", StringLeft($arData[$i], StringInStr($arData[$i], "")))
    Return True
   EndIf
  Next
Else
  MsgBox(0,"","didn't find " & $Fin & " in" & @LF & $TVTreeList)
EndIf
Return False
EndFunc
; generate the tree node list
Func TVGenTreeList($hwndTV, $WinTitle)
;let autoit know that I want to see the hidden text
AutoItSetOption("WinDetectHiddenText",1)
; get the hidden text before making selections
Local $OrigHiddenTxt = WinGetText("MicroPress 0120km Advanced Options")
Local $sTxt = ""
Local $sHiddenTxt = ""
Local $Stem = ""
$TVTreeList = "#0|#0|#0Paper Source"
; select each node in turn, record its address and text
for $i = 1 to ControlTreeView($WinTitle, "", $hwndTV, "GetItemCount", "#0") - 1
  $Stem = "#0|#" & $i
  for $j = 0 to ControlTreeView($WinTitle, "", $hwndTV, "GetItemCount", "#0|#" & $i) - 1
   Local $NumOfChildren = ControlTreeView($WinTitle, "", $hwndTV, "GetItemCount", "#0|#" & $i & "|#" & $j)
; if the current node has children, record those as well
   if $NumOfChildren > 0 Then
    for $k = 0 to ControlTreeView($WinTitle, "", $hwndTV, "GetItemCount", "#0|#" & $i & "|#" & $j) - 1
     ControlTreeView($WinTitle, "", $hwndTV, "Select", "#0|#" & $i & "|#" & $j & "|#" & $k)
     $sHiddenTxt = WinGetText($WinTitle)
;parse the hidden text and return what is new about it
     $sTxt = ExtractNewInfo($sHiddenTxt, $OrigHiddenTxt)
     $TVTreeList &= @CRLF & $Stem & "|#" & $j & "|#" & $k & "" & $sTxt
    Next
   Else
    ControlTreeView($WinTitle, "", $hwndTV, "Select", "#0|#" & $i & "|#" & $j)
    $sHiddenTxt = WinGetText($WinTitle)
    $sTxt = ExtractNewInfo($sHiddenTxt, $OrigHiddenTxt)
    $TVTreeList &= @CRLF & $Stem & "|#" & $j & "" & $sTxt
   EndIf
  Next
Next
AutoItSetOption("WinDetectHiddenText",0)
EndFunc
Func ExtractNewInfo($sHiddenTxt, $OrigHiddenTxt)
if $sHiddenTxt = $OrigHiddenTxt Then Return ""
Local $arNew = StringSplit($sHiddenTxt, @LF)
for $i = 1 to $arNew[0]
  if StringInStr(@LF & $OrigHiddenTxt & @LF, @LF & $arNew[$i] & @LF) = 0 Then
   if $arNew[$i] <> "Automatic" Then
    Return $arNew[$i]
   EndIf
  EndIf
Next
Return ""
EndFunc

Share this post


Link to post
Share on other sites

If you think it is an AutoIt bug then please open a ticket in Trac. Describe the problem and add a small reproducer script.


My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2017-04-18 - Version 1.4.8.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX (NEW 2017-02-27 - Version 1.3.1.0) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2015-04-01 - Version 0.4.0.0) - Download - General Help & Support - Example Scripts
Excel - Example Scripts - Wiki
Word - Wiki
PowerPoint (2015-06-06 - Version 0.0.5.0) - Download - General Help & Support

Tutorials:
ADO - Wiki

 

Share this post


Link to post
Share on other sites

I'd love to, but I think it's a UDF problem rather than an AutoIt problem.

Microsoft sends a pointer to nothing in response to this line in _GuiCtrlTreeView_GetText().

_SendMessage($hWnd, $TVM_GETITEMW, 0, $pMemory, 0, "wparam", "ptr")

so that every function that depends on _GuiCtrlTreeView_GetText() ends up failing.

Share this post


Link to post
Share on other sites

But UDF problems can be reported to Trac as well. Though before you do, as water explained, create a small reproducer here first to see if the problem is the code you've written or AutoIt.


_AdapterConnections()_AlwaysRun()_AppMon()_AppMonEx()_BinaryBin()_CheckMsgBox()_CmdLineRaw()_ContextMenu()_ConvertLHWebColor()/_ConvertSHWebColor()_DesktopDimensions()_DisplayPassword()_DotNet_Load()/_DotNet_Unload()_Fibonacci()_FileCompare()_FileCompareContents()_FileNameByHandle()_FilePrefix/SRE()_FindInFile()_GetBackgroundColor()/_SetBackgroundColor()_GetConrolID()_GetCtrlClass()_GetDirectoryFormat()_GetDriveMediaType()_GetFilename()/_GetFilenameExt()_GetHardwareID()_GetIP()_GetIP_Country()_GetOSLanguage()_GetSavedSource()_GetStringSize()_GetSystemPaths()_GetURLImage()_GIFImage()_GoogleWeather()_GUICtrlCreateGroup()_GUICtrlListBox_CreateArray()_GUICtrlListView_CreateArray()_GUICtrlListView_SaveCSV()_GUICtrlListView_SaveHTML()_GUICtrlListView_SaveTxt()_GUICtrlListView_SaveXML()_GUICtrlMenu_Recent()_GUICtrlMenu_SetItemImage()_GUICtrlTreeView_CreateArray()_GUIDisable()_GUIImageList_SetIconFromHandle()_GUIRegisterMsg()_GUISetIcon()_Icon_Clear()/_Icon_Set()_IdleTime()_InetGet()_InetGetGUI()_InetGetProgress()_IPDetails()_IsFileOlder()_IsGUID()_IsHex()_IsPalindrome()_IsRegKey()_IsStringRegExp()_IsSystemDrive()_IsUPX()_IsValidType()_IsWebColor()_Language()_Log()_MicrosoftInternetConnectivity()_MSDNDataType()_PathFull/GetRelative/Split()_PathSplitEx()_PrintFromArray()_ProgressSetMarquee()_ReDim()_RockPaperScissors()/_RockPaperScissorsLizardSpock()_ScrollingCredits_SelfDelete()_SelfRename()_SelfUpdate()_SendTo()_ShellAll()_ShellFile()_ShellFolder()_SingletonHWID()_SingletonPID()_Startup()_StringCompact()_StringIsValid()_StringRegExpMetaCharacters()_StringReplaceWholeWord()_StringStripChars()_Temperature()_TrialPeriod()_UKToUSDate()/_USToUKDate()_WinAPI_Create_CTL_CODE()_WinAPI_CreateGUID()_WMIDateStringToDate()/_DateToWMIDateString()Au3 script parsingAutoIt SearchAutoIt3 PortableAutoIt3WrapperToPragmaAutoItWinGetTitle()/AutoItWinSetTitle()CodingDirToHTML5FileInstallrFileReadLastChars()GeoIP databaseGUI - Only Close ButtonGUI ExamplesGUICtrlDeleteImage()GUICtrlGetBkColor()GUICtrlGetStyle()GUIEventsGUIGetBkColor()Int_Parse() & Int_TryParse()IsISBN()LockFile()Mapping CtrlIDsOOP in AutoItParseHeadersToSciTE()PasswordValidPasteBinPosts Per DayPreExpandProtect GlobalsQueue()Resource UpdateResourcesExSciTE JumpSettings INISHELLHOOKShunting-YardSignature CreatorStack()Stopwatch()StringAddLF()/StringStripLF()StringEOLToCRLF()VSCROLLWM_COPYDATAMore Examples...

Updated: 04/09/2015

Share this post


Link to post
Share on other sites

Is the treeview in a 64bit application and did you compile / run the AutoIt script as 64bit too?

See Remarks in help-file for ControlTreeView():

"As AutoIt is a 32-bit application some commands are not available when referencing a 64-bit application as Explorer when running on 64-bit Windows."

Share this post


Link to post
Share on other sites

yes, I build my print automation autoIt script with #AutoIt3Wrapper_UseX64=y and use it in 64 bit environments. Good thought, though.

Share this post


Link to post
Share on other sites

Did you create the reproducer by any chance?


_AdapterConnections()_AlwaysRun()_AppMon()_AppMonEx()_BinaryBin()_CheckMsgBox()_CmdLineRaw()_ContextMenu()_ConvertLHWebColor()/_ConvertSHWebColor()_DesktopDimensions()_DisplayPassword()_DotNet_Load()/_DotNet_Unload()_Fibonacci()_FileCompare()_FileCompareContents()_FileNameByHandle()_FilePrefix/SRE()_FindInFile()_GetBackgroundColor()/_SetBackgroundColor()_GetConrolID()_GetCtrlClass()_GetDirectoryFormat()_GetDriveMediaType()_GetFilename()/_GetFilenameExt()_GetHardwareID()_GetIP()_GetIP_Country()_GetOSLanguage()_GetSavedSource()_GetStringSize()_GetSystemPaths()_GetURLImage()_GIFImage()_GoogleWeather()_GUICtrlCreateGroup()_GUICtrlListBox_CreateArray()_GUICtrlListView_CreateArray()_GUICtrlListView_SaveCSV()_GUICtrlListView_SaveHTML()_GUICtrlListView_SaveTxt()_GUICtrlListView_SaveXML()_GUICtrlMenu_Recent()_GUICtrlMenu_SetItemImage()_GUICtrlTreeView_CreateArray()_GUIDisable()_GUIImageList_SetIconFromHandle()_GUIRegisterMsg()_GUISetIcon()_Icon_Clear()/_Icon_Set()_IdleTime()_InetGet()_InetGetGUI()_InetGetProgress()_IPDetails()_IsFileOlder()_IsGUID()_IsHex()_IsPalindrome()_IsRegKey()_IsStringRegExp()_IsSystemDrive()_IsUPX()_IsValidType()_IsWebColor()_Language()_Log()_MicrosoftInternetConnectivity()_MSDNDataType()_PathFull/GetRelative/Split()_PathSplitEx()_PrintFromArray()_ProgressSetMarquee()_ReDim()_RockPaperScissors()/_RockPaperScissorsLizardSpock()_ScrollingCredits_SelfDelete()_SelfRename()_SelfUpdate()_SendTo()_ShellAll()_ShellFile()_ShellFolder()_SingletonHWID()_SingletonPID()_Startup()_StringCompact()_StringIsValid()_StringRegExpMetaCharacters()_StringReplaceWholeWord()_StringStripChars()_Temperature()_TrialPeriod()_UKToUSDate()/_USToUKDate()_WinAPI_Create_CTL_CODE()_WinAPI_CreateGUID()_WMIDateStringToDate()/_DateToWMIDateString()Au3 script parsingAutoIt SearchAutoIt3 PortableAutoIt3WrapperToPragmaAutoItWinGetTitle()/AutoItWinSetTitle()CodingDirToHTML5FileInstallrFileReadLastChars()GeoIP databaseGUI - Only Close ButtonGUI ExamplesGUICtrlDeleteImage()GUICtrlGetBkColor()GUICtrlGetStyle()GUIEventsGUIGetBkColor()Int_Parse() & Int_TryParse()IsISBN()LockFile()Mapping CtrlIDsOOP in AutoItParseHeadersToSciTE()PasswordValidPasteBinPosts Per DayPreExpandProtect GlobalsQueue()Resource UpdateResourcesExSciTE JumpSettings INISHELLHOOKShunting-YardSignature CreatorStack()Stopwatch()StringAddLF()/StringStripLF()StringEOLToCRLF()VSCROLLWM_COPYDATAMore Examples...

Updated: 04/09/2015

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

  • Similar Content

    • corgano
      By corgano
      I can't explain easily what i want to do, so i made a picture:

      What i want to do is to specify a treeview item, and then be able to move it right to be a child of the previous item, or left to do the opposite (make a child into a sibling). I also want to move and child items of the target with it, like in the bottom half of the above image depicts. However I didn't see any functions in the help file to move items around. All i want is a button that when pressed, makes the selected item and any of selected item's children move one layer to the right / left. Does anyone know how?

      Edit: something along the lines of _GUICtrlTreeView_Level but SET level
    • Tjalve
      By Tjalve
      Hi everyone. Im creating a GUI for an application. Im usinga  treeview item and i want to add some information to the side of the treeview based on what cilditem you are pressing. For the moment i have a "get info" button that works. But that means that you have to select your child in the treeview, and then press a button to gte the info. I want the info to be visable as soon as you select it.
      With uther controls you can just add it to the loop but it doesnt seem to work with tyhe UDF version of the treeview control. Is there anything I can do?
      #include <GUIConstantsEx.au3> #include <GuiTreeView.au3> #include <MsgBoxConstants.au3> #include <WindowsConstants.au3> ;~ Create GUI dim $guilabel[7] local $currentlevel = 1 Local $hGui = GUICreate( "Grejs", 1000, 500, 600, 300, BitOR( $GUI_SS_DEFAULT_GUI, $WS_MAXIMIZEBOX, $WS_SIZEBOX ) ) Local $iBorderWidth = 4, $aPos = WinGetClientSize( $hGui ) $idTV = _GUICtrlTreeView_Create($hGui, $iBorderWidth, $iBorderWidth, $aPos[0]-2*$iBorderWidth-400, $aPos[1]-2*$iBorderWidth-30 ) $root_level = _GUICtrlTreeView_Add($idTV,0,"Root") $item1 = _GUICtrlTreeView_AddChild($idTV, $root_level, "child1") $item2 = _GUICtrlTreeView_AddChild($idTV, $root_level, "child2") $item3 = _GUICtrlTreeView_AddChild($idTV, $root_level, "child3") ;~ Start Gui GUISetState() While 1 Switch GUIGetMsg() Case $GUI_EVENT_CLOSE ExitLoop Case $idTV MsgBox(0,"","") EndSwitch WEnd GUIDelete($hGui) Exit In this example, i want the msgbox to appear whenevr i select something in the treeview. It ios not my full code, but its an example of the problam i have. Help is much appritiated
      /G
    • Trolleule
      By Trolleule
      Hey,
      i'm building a "Jump To" registry key function and trying to get access to the regedit treeview control like this:
      #include <GUIConstants.au3> #include <GuiTreeView.au3> #include <TreeViewConstants.au3> #include <SendMessage.au3> #include <WinAPI.au3> Global $h_item ShellExecute("regedit.exe") ;~ Local $pid = ProcessExists("regedit.exe") ;~ If $pid Then ;~ $h_tree = WinHandFromPID($pid, "[CLASS:RegEdit_RegEdit]") ;~ WinActivate("[CLASS:RegEdit_RegEdit]", "") ;~ EndIf WinWaitActive("[CLASS:RegEdit_RegEdit]", "") ;~ WinActivate("[CLASS:RegEdit_RegEdit]", "") ;~ WinSetState("[CLASS:RegEdit_RegEdit]", "", @SW_SHOW) ; activate ;~ WinSetState("[CLASS:RegEdit_RegEdit]", "", @SW_RESTORE) ; activate ;~ WinSetState("[CLASS:RegEdit_RegEdit]", "", @SW_RESTORE) ; activate $h_tree = WinGetHandle("[CLASS:RegEdit_RegEdit]", "") ;~ $ret = _WinAPI_ShowWindow($h_tree, @SW_RESTORE) $ctrl = ControlGetHandle($h_tree, "", "[CLASS:SysTreeView32]") ConsoleWrite("$h_tree: " & $h_tree & @CRLF) ConsoleWrite("$ctrl: " & $ctrl & @CRLF) $show = GUICtrlCreateButton("Show", 70, 180, 70, 20) Show() ;~ While 1 ;~ Sleep(200) ;~ WEnd Func Show() $result = "" _SendMessage($ctrl, $WM_SETFOCUS, 0, 0) If @error Then ConsoleWrite("error" & @CRLF) $h_item = _SendMessage($ctrl, $TVM_GETNEXTITEM, $TVGN_ROOT, 0) $split = StringSplit("HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion\Explorer\Shell Folders", "\") For $i=1 To $split[0] ConsoleWrite("item bevor findkey: " & $h_item & @CRLF) $h_item = FindKey($h_item, $split[$i]) If $h_item = 0 Then Return _SendMessage($ctrl, $TVM_SELECTITEM, 0x0009, $h_item) ; expand tree _GUICtrlTreeView_Expand($ctrl, $h_item) Next MsgBox(0, "dsfsdf", "sdfsf") Exit EndFunc Func FindKey($hItemParent, $sKey) $h_item = _SendMessage($ctrl, $TVM_GETNEXTITEM, $TVGN_CHILD, $hItemParent) ConsoleWrite("child : " & $h_item & " key: " & $sKey & " parent: " & $hItemParent & " parent text: " & _GUICtrlTreeView_GetText($ctrl, $hItemParent) & @CRLF) While $h_item <> 0 Local $sItemText = _GUICtrlTreeView_GetText($ctrl, $h_item) ConsoleWrite("text : " & $sItemText & @CRLF) If $sItemText = $sKey Then Return $h_item $h_item = _SendMessage($ctrl, $TVM_GETNEXTITEM, $TVGN_NEXT, $h_item) ConsoleWrite("next : " & $h_item & @CRLF) WEnd ConsoleWrite("not found" & @CRLF) Return 0 EndFunc it's working, when i start regedit.exe within my app. But can't get it work when regedit.exe already open. Some ideas?
    • tarretarretarre
      By tarretarretarre
      So I am trying to create a file tree structure Using _FileListToArrayRec with GuiCtrlCreateTreeView. But i have some problems with levels of directorys. In my mind there is nothing wrong with my logic, but obviously it is, since i dont get the output i want  
       
      Here is a printscreen of the outcome, the array is sorted so it feels like it should be pretty easy, but its not
       
      Here is the working code
      #include <File.au3> #include <Array.au3> #include <GUITreeview.au3> #include <WINapiSHELLEX.au3> Local $hGI = GUICreate("test", 500,500) Local $hTreeView = GUICtrlCreateTreeView(0,0,500,500) GUISetState() Local $arr = _GuictrlTreeview__FileListToArrayRec($hTreeView,"C:\Autoit\REMOVE", "*.au3||BackUp;.git*;___TrashCan") _ArrayDisplay($arr) Func _GuictrlTreeview__FileListToArrayRec($hTreeView, $sPath, $sFilter) if StringRight($sPath,1) == "\" Then $sPath = StringLeft($sPath, StringLen($sPath) - 1) if not FileExists($sPath) Then Return SetError(1,0,0) Local $aFileList = _FileListToArrayRec($sPath, $sFilter, $FLTAR_FILESFOLDERS, $FLTAR_RECUR, $FLTAR_SORT, $FLTAR_FULLPATH) if @error Then Return SetError(1,0,0) Local $aParents[1] = [0] Local $sLastParentDirectory = False Local $hLastParentTreeItem = False Local $hLastParentChildItem = False ; Set default icons (late rreplaced with file associated icon $hImageList = _GUIImageList_Create(16, 16, 5, 1) _GUICtrlTreeView_SetNormalImageList($hTreeView, $hImageList) ; Begin tree update _GUICtrlTreeView_BeginUpdate($hTreeView) For $i = 1 To $aFileList[0] Local $sCurFullFilePath = $aFileList[$i] Local $sCurFileName = _Misc_GetFileName($aFileList[$i], False) ;Get da icon Local $hIcon = _WinAPI_ShellExtractAssociatedIcon($sCurFullFilePath, 1) Local $hIcon_Index = _GUIImageList_ReplaceIcon($hImageList, -1, $hIcon) ;If directory If FileGetAttrib($sCurFullFilePath) == "D" Then ; Check if sub has file to add If StringLeft($sCurFullFilePath, StringLen($sLastParentDirectory)) == $sLastParentDirectory Then $hLastParentChildItem = _GUICtrlTreeView_AddChild($hTreeView, $hLastParentTreeItem, $sCurFileName, $hIcon_Index, $hIcon_Index) ;Loop will end here ContinueLoop EndIf ;Create new parent folder & Update parents $sLastParentDirectory = $sCurFullFilePath $hLastParentTreeItem = _GUICtrlTreeView_Add($hTreeView, 0, StringFormat("%s", $sCurFileName), $hIcon_Index, $hIcon_Index) Else If Not $hLastParentChildItem Then ;ConsoleWrite($hLastParentTreeItem&" "&$sCurFileName&@CRLF) _GUICtrlTreeView_AddChild($hTreeView, $hLastParentTreeItem, $sCurFileName, $hIcon_Index, $hIcon_Index) Else _GUICtrlTreeView_AddChild($hTreeView, $hLastParentChildItem, $sCurFileName, $hIcon_Index, $hIcon_Index) EndIf EndIf Next ; End update _GUICtrlTreeView_EndUpdate($hTreeView) Return $aFileList EndFunc Func _Misc_GetFileName($sFilePath, $KeepExtension = True) ; Gets the filename Local $StringSPlit = StringSplit($sFilePath, "\") If Not $KeepExtension Then Return StringRegExpReplace($StringSPlit[$StringSPlit[0]], "\.(.*?)[a-zA-Z1234567890_-]{1,}+", "") Return $StringSPlit[$StringSPlit[0]] EndFunc ;==>_Misc_GetFileName  
      Any tips ?
       
      Thanks in advance
    • Kanashius
      By Kanashius
      This UDF can be used to make a Treeview and/or Listview able to browse Files.
      If you like it, please leave me a comment, also if you have any suggestions to make it better or if you found bugs.
      FileExplorerTreeAndListview_source.zip