Jump to content
Sign in to follow this  
Yashied

TVExplorer UDF

Recommended Posts

Yashied,

I have asked in post #28 a questions that I thought I found an answer for it, but indeed I did not.

It was about how to detach a TV root iem and recreating it by using the following code:

My code was simply like this;

GUICtrlTreeView_Delete($hTV,  0)
GUICtrlTVExplorer_AttachFolder ( $hTV , $sPath)

When I delete the tree view item and attach new path to it its works and I do not see any error

until I exit the main application.

Once I close the main application I get crash or error such as: "!>12:13:42 AutoIT3.exe ended.rc:-1073741819"

Or " autoit3.exe - Application error , the instruction at 0x7c911980 referenced memory at 0x00000000. The memory could not be "read".

I have destroy the control on exit (either by _GUICtrlTVExplorer_Destroy() and _GUICtrlTVExplorer_DestroyAll())

and try almost anything to avoid the error but nothing help.

My code create once the control (_GUICtrlTVExplorer_Create) during the life time of the process

but dynamicly load the TV control with different path (I am using combobox filled with different path items)

.

I know could be many reasons to crash the application on exits but after investigating the issue many hours I have got to conclusion that the deleted root cause it.

Is there anything to do to detach the control without destroying it?

by the way, I noticed that the crash usually happens when expanding the TV items manually. If not expanding them then there is no crash. I am realy frustrated here...


Be Green Now or Never (BGNN)!

Share this post


Link to post
Share on other sites

You should not use GUICtrlTreeView_Delete().

#Include <ComboConstants.au3>
#Include <GUIConstantsEx.au3>
#Include <TVExplorer.au3>
#Include <WindowsConstants.au3>

GUICreate('MyGUI', 400, 431)
$Combo = GUICtrlCreateCombo(@WorkingDir, 10, 10, 380, 21, $CBS_DROPDOWNLIST)
GUICtrlSetData(-1, @UserProfileDir & '|' & @ProgramFilesDir & '|' & @WindowsDir, @WorkingDir)
$hTV = _GUICtrlTVExplorer_Create(@WorkingDir, 10, 41, 380, 380, -1, $WS_EX_CLIENTEDGE)
GUISetState()

While 1
    Switch _GUICtrlTVExplorer_GetMsg()
        Case $GUI_EVENT_CLOSE
            Exit
        Case $Combo
            _GUICtrlTVExplorer_AttachFolder($hTV, GUICtrlRead($Combo))
    EndSwitch
WEnd

Share this post


Link to post
Share on other sites

You should not use GUICtrlTreeView_Delete().

#Include <ComboConstants.au3>
#Include <GUIConstantsEx.au3>
#Include <TVExplorer.au3>
#Include <WindowsConstants.au3>

GUICreate('MyGUI', 400, 431)
$Combo = GUICtrlCreateCombo(@WorkingDir, 10, 10, 380, 21, $CBS_DROPDOWNLIST)
GUICtrlSetData(-1, @UserProfileDir & '|' & @ProgramFilesDir & '|' & @WindowsDir, @WorkingDir)
$hTV = _GUICtrlTVExplorer_Create(@WorkingDir, 10, 41, 380, 380, -1, $WS_EX_CLIENTEDGE)
GUISetState()

While 1
    Switch _GUICtrlTVExplorer_GetMsg()
        Case $GUI_EVENT_CLOSE
            Exit
        Case $Combo
            _GUICtrlTVExplorer_AttachFolder($hTV, GUICtrlRead($Combo))
    EndSwitch
WEnd

Hi Yashid,

The TVExplorer control is beautiful one. I found the error. it was not about deleting items or attaching folder.

I found that the onexit function that I am using in my script was called twice, so probably its caused memory deallocation

problem. Strangly it was happend only after expanding the tree's node items.

Regards.

BTW: For those who wants example with multiple GUI (Father/Chiled) here is a one:

#include <ButtonConstants.au3>
#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>
#include <TVExplorer.au3>
#Include <ComboConstants.au3>
Global $hForm, $hTV[3], $Input[3], $hFocus = 0, $Dummy, $Path, $Style, $oFILE 
$Father = GUICreate("Form1", 380, 193, 193, 115)
$Button1 = GUICtrlCreateButton("Button1", 16, 40, 75, 25, 0)
GUISetState(@SW_SHOW)
Global $Child, $Button2 ,$Combo
_CreateChiled()

While 1
    $nMsg = _GUICtrlTVExplorer_GetMsg(1)
    Switch $nMsg[1]
        Case $Father
            Switch $nMsg[0]
                Case $GUI_EVENT_CLOSE
                    _GUICtrlTVExplorer_DestroyAll()
                    Exit
                Case $Button1
                    GUISetState(@SW_SHOW, $Child)
            EndSwitch
        Case $Child
            Switch $nMsg[0]
                Case $GUI_EVENT_CLOSE
                    GUISetState(@SW_HIDE, $Child)
                Case $Dummy
                    $Path = _GUICtrlTVExplorer_GetSelected($hFocus)
                    _GUICtrlTVExplorer_AttachFolder($hFocus)
                    _GUICtrlTVExplorer_Expand($hFocus, $Path, 0)
                    $hFocus = 0
                 Case $Combo
                        _ReCreateTVControl($hTV, GUICtrlRead($Combo))
            EndSwitch
    EndSwitch
WEnd
Func _ReCreateTVControl(ByRef $hTV, $Path)
    _GUICtrlTVExplorer_AttachFolder($hTV[0], $Path)
EndFunc   ;==>_ReCreateTVControl

Func _CreateChiled()
    $Child = GUICreate("Edit File System", 400, 400, 0, 0, -1, BitOR($WS_EX_TOOLWINDOW, $WS_EX_MDICHILD), $Father)
    $Input[0] = GUICtrlCreateInput('', 20, 20, 320, 19)
    GUICtrlSetState(-1, $GUI_DISABLE)
    $hTV[0] = _GUICtrlTVExplorer_Create(@ProgramFilesDir, 20, 48, 320, 210, -1, $WS_EX_CLIENTEDGE, -1, '_TVEvent')
    GUICtrlSetBkColor(-1, 0xF1F4F7)
    $Combo = GUICtrlCreateCombo(@WorkingDir, 10, 270, 380, 21, $CBS_DROPDOWNLIST)
    GUICtrlSetData(-1, @UserProfileDir & '|' & @ProgramFilesDir & '|' & @WindowsDir, @WorkingDir)
    $Dummy = GUICtrlCreateDummy()
    GUISetState(@SW_HIDE, $Child)
EndFunc   ;==>_CreateChiled

Func _TVEvent($hWnd, $iMsg, $sPath, $hItem)
    consolewrite("$hWnd=" & $hWnd & ", " & "$iMsg=" & "," & "$sPath=" & $sPath & ", " & "$hItem=" & $hItem & @CRLF)
    Switch $iMsg
        Case $TV_NOTIFY_BEGINUPDATE
            GUISetCursor(1, 1)
        Case $TV_NOTIFY_ENDUPDATE
            GUISetCursor(2)
        Case $TV_NOTIFY_SELCHANGED
                If $hTV[0] = $hWnd Then
                    _TVSetPath($Input[0], $sPath)
                EndIf
        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   ;==>_TVSetPath

Be Green Now or Never (BGNN)!

Share this post


Link to post
Share on other sites

Hi Yashied

Melba aimed me @ TVExplorer so I immediately downloaded & tested but there seems to be a small issue which might be an easy fix.

Firstly, I did add " #include APIConstants.au3" to the example as noted above by Wakillon.

The TVExplorer.au3 is in my User Includes which is correctly configed and everything is as up to date as possible.

They are only warnings and the example does continue to operate but figured you should know.

>"C:\Program Files (x86)\AutoIt3\SciTE\AutoIt3Wrapper\AutoIt3Wrapper.exe" /run /prod /ErrorStdOut /in "E:AutoIT_ScriptsTVExplorerTVExplorer_Ex.au3" /UserParams   
+>13:13:52 Starting AutoIt3Wrapper v.2.1.0.8    Environment(Language:0409  Keyboard:00000409  OS:WIN_7/Service Pack 1  CPU:X64 OS:X64)
>Running AU3Check (1.54.22.0)  from:C:Program Files (x86)AutoIt3
E:AutoIT_ScriptsUSER_INCLUDETVExplorer.au3(833,66) : WARNING: $SEM_FAILCRITICALERRORS: possibly used before declaration.
Local $Mode = _WinAPI_SetErrorMode(BitOR($SEM_FAILCRITICALERRORS,
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^
E:AutoIT_ScriptsUSER_INCLUDETVExplorer.au3(833,91) : WARNING: $SEM_NOOPENFILEERRORBOX: possibly used before declaration.
Local $Mode = _WinAPI_SetErrorMode(BitOR($SEM_FAILCRITICALERRORS, $SEM_NOOPENFILEERRORBOX)
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^
E:AutoIT_ScriptsUSER_INCLUDETVExplorer.au3(945,39) : WARNING: $SHGFI_SMALLICON: possibly used before declaration.
Local $Flags = BitOR($SHGFI_SMALLICON,
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^
E:AutoIT_ScriptsUSER_INCLUDETVExplorer.au3(945,60) : WARNING: $SHGFI_SYSICONINDEX: possibly used before declaration.
Local $Flags = BitOR($SHGFI_SMALLICON, $SHGFI_SYSICONINDEX)
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^
E:AutoIT_ScriptsUSER_INCLUDETVExplorer.au3(949,33) : WARNING: $SHGFI_OPENICON: possibly used before declaration.
  $Flags = BitOR($SHGFI_OPENICON,
  ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^
E:AutoIT_ScriptsUSER_INCLUDETVExplorer.au3(994,61) : WARNING: $SHGFI_ICON: possibly used before declaration.
   $hIL = _WinAPI_ShellGetFileInfo($sPath, BitOR($SHGFI_ICON,
   ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^
E:AutoIT_ScriptsUSER_INCLUDETVExplorer.au3(994,82) : WARNING: $SHGFI_OVERLAYINDEX: possibly used before declaration.
   $hIL = _WinAPI_ShellGetFileInfo($sPath, BitOR($SHGFI_ICON, $SHGFI_OVERLAYINDEX,
   ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^
E:AutoIT_ScriptsUSER_INCLUDETVExplorer.au3(994,108) : WARNING: $SHGFI_USEFILEATTRIBUTES: possibly used before declaration.
   $hIL = _WinAPI_ShellGetFileInfo($sPath, BitOR($SHGFI_ICON, $SHGFI_OVERLAYINDEX, $SHGFI_USEFILEATTRIBUTES,
   ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^
E:AutoIT_ScriptsUSER_INCLUDETVExplorer.au3(1082,40) : WARNING: $SSF_SHOWALLOBJECTS: possibly used before declaration.
Local $Param[3] = [$SSF_SHOWALLOBJECTS,
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^
E:AutoIT_ScriptsUSER_INCLUDETVExplorer.au3(1082,64) : WARNING: $SSF_SHOWEXTENSIONS: possibly used before declaration.
Local $Param[3] = [$SSF_SHOWALLOBJECTS, 0, $SSF_SHOWEXTENSIONS]
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^
E:AutoIT_ScriptsUSER_INCLUDETVExplorer.au3(1362,28) : WARNING: $SIID_DOCNOASSOC: possibly used before declaration.
  $ID[0] = $SIID_DOCNOASSOC
  ~~~~~~~~~~~~~~~~~~~~~~~~~^
E:AutoIT_ScriptsUSER_INCLUDETVExplorer.au3(1363,24) : WARNING: $SIID_FOLDER: possibly used before declaration.
  $ID[1] = $SIID_FOLDER
  ~~~~~~~~~~~~~~~~~~~~~^
E:AutoIT_ScriptsUSER_INCLUDETVExplorer.au3(1364,28) : WARNING: $SIID_FOLDEROPEN: possibly used before declaration.
  $ID[2] = $SIID_FOLDEROPEN
  ~~~~~~~~~~~~~~~~~~~~~~~~~^
E:AutoIT_ScriptsUSER_INCLUDETVExplorer.au3(1366,69) : WARNING: $SHGSI_ICON: possibly used before declaration.
   $tIcon = _WinAPI_ShellGetStockIconInfo($ID[$i], BitOR($SHGSI_ICON,
   ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^
E:AutoIT_ScriptsUSER_INCLUDETVExplorer.au3(1366,87) : WARNING: $SHGSI_SMALLICON: possibly used before declaration.
   $tIcon = _WinAPI_ShellGetStockIconInfo($ID[$i], BitOR($SHGSI_ICON, $SHGSI_SMALLICON)
   ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^
E:AutoIT_ScriptsUSER_INCLUDETVExplorer.au3(1404,28) : WARNING: $SIID_DRIVEFIXED: possibly used before declaration.
  $ID[0] = $SIID_DRIVEFIXED
  ~~~~~~~~~~~~~~~~~~~~~~~~~^
E:AutoIT_ScriptsUSER_INCLUDETVExplorer.au3(1405,29) : WARNING: $SIID_DRIVEREMOVE: possibly used before declaration.
  $ID[1] = $SIID_DRIVEREMOVE
  ~~~~~~~~~~~~~~~~~~~~~~~~~~^
E:AutoIT_ScriptsUSER_INCLUDETVExplorer.au3(1406,26) : WARNING: $SIID_DRIVERAM: possibly used before declaration.
  $ID[2] = $SIID_DRIVERAM
  ~~~~~~~~~~~~~~~~~~~~~~~^
E:AutoIT_ScriptsUSER_INCLUDETVExplorer.au3(1407,25) : WARNING: $SIID_DRIVECD: possibly used before declaration.
  $ID[3] = $SIID_DRIVECD
  ~~~~~~~~~~~~~~~~~~~~~~^
E:AutoIT_ScriptsUSER_INCLUDETVExplorer.au3(1408,26) : WARNING: $SIID_DRIVENET: possibly used before declaration.
  $ID[4] = $SIID_DRIVENET
  ~~~~~~~~~~~~~~~~~~~~~~~^
E:AutoIT_ScriptsTVExplorerTVExplorer_Ex.au3 - 0 error(s), 20 warning(s)

Thanks to ALL THE CONTRIBUTORS

Such a community ! Love it !!

WhiteStar

Share this post


Link to post
Share on other sites

Search WinAPIEx.au3 by Yashied and there you'll find APIConstants.au3.


UDF List:

 
_AdapterConnections()_AlwaysRun()_AppMon()_AppMonEx()_ArrayFilter/_ArrayReduce_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: 22/04/2018

Share this post


Link to post
Share on other sites

Hi Guiness

I had the TVExplorer_Ex.au3 set this way:

#Include <GUIConstantsEx.au3>
#Include <WinAPIEx.au3>
#Include <GUITreeView.au3>
#Include <TVExplorer.au3>
#Include <TreeViewConstants.au3>
#Include <WindowsConstants.au3>
#Include <APIConstants.au3>

Thanks to your quick tip and a quick glance @ WinAPIEx, I relocated the #Include <APIConstants.au3> above #Include <WinAPIEx.au3> it works without error messages.

I have the latest WinAPIEx.au3 (which changes so often I feel like I need to update almost weekly LOL) but there is no Include in it for APIConstants.au3, maybe it was omitted during the last update or two, I don't know.

Thanks

WhiteStar

Share this post


Link to post
Share on other sites

APIConstants.au3 is separate to keep the size of WinAPIEx.au3 down (or so I've understood it). Sometimes I've used functions from WinAPIEx but haven't needed to include APIConstants.au3, though these are rare occasions.


UDF List:

 
_AdapterConnections()_AlwaysRun()_AppMon()_AppMonEx()_ArrayFilter/_ArrayReduce_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: 22/04/2018

Share this post


Link to post
Share on other sites

Hi all, I've just downloaded and updated TVExplorer and WinAPIEx but when I run the example I get the following warnings/errors, almost the same as WhiteStar, (he only got warnings), did above.

>"C:\Program Files (x86)\AutoIt3\SciTE\AutoIt3Wrapper\AutoIt3Wrapper.exe" /prod /AU3Check /in "D:\My Documents\AutoIt\TVExplorer\TVExplorer.au3"
+>21:38:19 Starting AutoIt3Wrapper v.2.1.0.33 Environment(Language:0409 Keyboard:00000409 OS:WIN_7/Service Pack 1 CPU:X64 OS:X64)
>Running AU3Check (1.54.22.0) from:C:\Program Files (x86)\AutoIt3
D:\My Documents\AutoIt\TVExplorer\TVExplorer.au3(833,66) : WARNING: $SEM_FAILCRITICALERRORS: possibly used before declaration.
Local $Mode = _WinAPI_SetErrorMode(BitOR($SEM_FAILCRITICALERRORS,
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^
D:\My Documents\AutoIt\TVExplorer\TVExplorer.au3(833,91) : WARNING: $SEM_NOOPENFILEERRORBOX: possibly used before declaration.
Local $Mode = _WinAPI_SetErrorMode(BitOR($SEM_FAILCRITICALERRORS, $SEM_NOOPENFILEERRORBOX)
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^
D:\My Documents\AutoIt\TVExplorer\TVExplorer.au3(945,39) : WARNING: $SHGFI_SMALLICON: possibly used before declaration.
Local $Flags = BitOR($SHGFI_SMALLICON,
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^
D:\My Documents\AutoIt\TVExplorer\TVExplorer.au3(945,60) : WARNING: $SHGFI_SYSICONINDEX: possibly used before declaration.
Local $Flags = BitOR($SHGFI_SMALLICON, $SHGFI_SYSICONINDEX)
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^
D:\My Documents\AutoIt\TVExplorer\TVExplorer.au3(949,33) : WARNING: $SHGFI_OPENICON: possibly used before declaration.
$Flags = BitOR($SHGFI_OPENICON,
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^
D:\My Documents\AutoIt\TVExplorer\TVExplorer.au3(994,61) : WARNING: $SHGFI_ICON: possibly used before declaration.
$hIL = _WinAPI_ShellGetFileInfo($sPath, BitOR($SHGFI_ICON,
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^
D:\My Documents\AutoIt\TVExplorer\TVExplorer.au3(994,82) : WARNING: $SHGFI_OVERLAYINDEX: possibly used before declaration.
$hIL = _WinAPI_ShellGetFileInfo($sPath, BitOR($SHGFI_ICON, $SHGFI_OVERLAYINDEX,
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^
D:\My Documents\AutoIt\TVExplorer\TVExplorer.au3(994,108) : WARNING: $SHGFI_USEFILEATTRIBUTES: possibly used before declaration.
$hIL = _WinAPI_ShellGetFileInfo($sPath, BitOR($SHGFI_ICON, $SHGFI_OVERLAYINDEX, $SHGFI_USEFILEATTRIBUTES,
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^
D:\My Documents\AutoIt\TVExplorer\TVExplorer.au3(1082,40) : WARNING: $SSF_SHOWALLOBJECTS: possibly used before declaration.
Local $Param[3] = [$SSF_SHOWALLOBJECTS,
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^
D:\My Documents\AutoIt\TVExplorer\TVExplorer.au3(1082,64) : WARNING: $SSF_SHOWEXTENSIONS: possibly used before declaration.
Local $Param[3] = [$SSF_SHOWALLOBJECTS, 0, $SSF_SHOWEXTENSIONS]
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^
D:\My Documents\AutoIt\TVExplorer\TVExplorer.au3(1362,28) : WARNING: $SIID_DOCNOASSOC: possibly used before declaration.
$ID[0] = $SIID_DOCNOASSOC
~~~~~~~~~~~~~~~~~~~~~~~~~^
D:\My Documents\AutoIt\TVExplorer\TVExplorer.au3(1363,24) : WARNING: $SIID_FOLDER: possibly used before declaration.
$ID[1] = $SIID_FOLDER
~~~~~~~~~~~~~~~~~~~~~^
D:\My Documents\AutoIt\TVExplorer\TVExplorer.au3(1364,28) : WARNING: $SIID_FOLDEROPEN: possibly used before declaration.
$ID[2] = $SIID_FOLDEROPEN
~~~~~~~~~~~~~~~~~~~~~~~~~^
D:\My Documents\AutoIt\TVExplorer\TVExplorer.au3(1366,69) : WARNING: $SHGSI_ICON: possibly used before declaration.
$tIcon = _WinAPI_ShellGetStockIconInfo($ID[$i], BitOR($SHGSI_ICON,
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^
D:\My Documents\AutoIt\TVExplorer\TVExplorer.au3(1366,87) : WARNING: $SHGSI_SMALLICON: possibly used before declaration.
$tIcon = _WinAPI_ShellGetStockIconInfo($ID[$i], BitOR($SHGSI_ICON, $SHGSI_SMALLICON)
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^
D:\My Documents\AutoIt\TVExplorer\TVExplorer.au3(1404,28) : WARNING: $SIID_DRIVEFIXED: possibly used before declaration.
$ID[0] = $SIID_DRIVEFIXED
~~~~~~~~~~~~~~~~~~~~~~~~~^
D:\My Documents\AutoIt\TVExplorer\TVExplorer.au3(1405,29) : WARNING: $SIID_DRIVEREMOVE: possibly used before declaration.
$ID[1] = $SIID_DRIVEREMOVE
~~~~~~~~~~~~~~~~~~~~~~~~~~^
D:\My Documents\AutoIt\TVExplorer\TVExplorer.au3(1406,26) : WARNING: $SIID_DRIVERAM: possibly used before declaration.
$ID[2] = $SIID_DRIVERAM
~~~~~~~~~~~~~~~~~~~~~~~^
D:\My Documents\AutoIt\TVExplorer\TVExplorer.au3(1407,25) : WARNING: $SIID_DRIVECD: possibly used before declaration.
$ID[3] = $SIID_DRIVECD
~~~~~~~~~~~~~~~~~~~~~~^
D:\My Documents\AutoIt\TVExplorer\TVExplorer.au3(1408,26) : WARNING: $SIID_DRIVENET: possibly used before declaration.
$ID[4] = $SIID_DRIVENET
~~~~~~~~~~~~~~~~~~~~~~~^
D:\My Documents\AutoIt\TVExplorer\TVExplorer.au3(833,66) : ERROR: $SEM_FAILCRITICALERRORS: undeclared global variable.
Local $Mode = _WinAPI_SetErrorMode(BitOR($SEM_FAILCRITICALERRORS,
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^
D:\My Documents\AutoIt\TVExplorer\TVExplorer.au3(833,91) : ERROR: $SEM_NOOPENFILEERRORBOX: undeclared global variable.
Local $Mode = _WinAPI_SetErrorMode(BitOR($SEM_FAILCRITICALERRORS, $SEM_NOOPENFILEERRORBOX)
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^
D:\My Documents\AutoIt\TVExplorer\TVExplorer.au3(945,39) : ERROR: $SHGFI_SMALLICON: undeclared global variable.
Local $Flags = BitOR($SHGFI_SMALLICON,
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^
D:\My Documents\AutoIt\TVExplorer\TVExplorer.au3(945,60) : ERROR: $SHGFI_SYSICONINDEX: undeclared global variable.
Local $Flags = BitOR($SHGFI_SMALLICON, $SHGFI_SYSICONINDEX)
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^
D:\My Documents\AutoIt\TVExplorer\TVExplorer.au3(949,33) : ERROR: $SHGFI_OPENICON: undeclared global variable.
$Flags = BitOR($SHGFI_OPENICON,
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^
D:\My Documents\AutoIt\TVExplorer\TVExplorer.au3(994,61) : ERROR: $SHGFI_ICON: undeclared global variable.
$hIL = _WinAPI_ShellGetFileInfo($sPath, BitOR($SHGFI_ICON,
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^
D:\My Documents\AutoIt\TVExplorer\TVExplorer.au3(994,82) : ERROR: $SHGFI_OVERLAYINDEX: undeclared global variable.
$hIL = _WinAPI_ShellGetFileInfo($sPath, BitOR($SHGFI_ICON, $SHGFI_OVERLAYINDEX,
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^
D:\My Documents\AutoIt\TVExplorer\TVExplorer.au3(994,108) : ERROR: $SHGFI_USEFILEATTRIBUTES: undeclared global variable.
$hIL = _WinAPI_ShellGetFileInfo($sPath, BitOR($SHGFI_ICON, $SHGFI_OVERLAYINDEX, $SHGFI_USEFILEATTRIBUTES,
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^
D:\My Documents\AutoIt\TVExplorer\TVExplorer.au3(1082,40) : ERROR: $SSF_SHOWALLOBJECTS: undeclared global variable.
Local $Param[3] = [$SSF_SHOWALLOBJECTS,
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^
D:\My Documents\AutoIt\TVExplorer\TVExplorer.au3(1082,64) : ERROR: $SSF_SHOWEXTENSIONS: undeclared global variable.
Local $Param[3] = [$SSF_SHOWALLOBJECTS, 0, $SSF_SHOWEXTENSIONS]
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^
D:\My Documents\AutoIt\TVExplorer\TVExplorer.au3(1362,28) : ERROR: $SIID_DOCNOASSOC: undeclared global variable.
$ID[0] = $SIID_DOCNOASSOC
~~~~~~~~~~~~~~~~~~~~~~~~~^
D:\My Documents\AutoIt\TVExplorer\TVExplorer.au3(1363,24) : ERROR: $SIID_FOLDER: undeclared global variable.
$ID[1] = $SIID_FOLDER
~~~~~~~~~~~~~~~~~~~~~^
D:\My Documents\AutoIt\TVExplorer\TVExplorer.au3(1364,28) : ERROR: $SIID_FOLDEROPEN: undeclared global variable.
$ID[2] = $SIID_FOLDEROPEN
~~~~~~~~~~~~~~~~~~~~~~~~~^
D:\My Documents\AutoIt\TVExplorer\TVExplorer.au3(1366,69) : ERROR: $SHGSI_ICON: undeclared global variable.
$tIcon = _WinAPI_ShellGetStockIconInfo($ID[$i], BitOR($SHGSI_ICON,
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^
D:\My Documents\AutoIt\TVExplorer\TVExplorer.au3(1366,87) : ERROR: $SHGSI_SMALLICON: undeclared global variable.
$tIcon = _WinAPI_ShellGetStockIconInfo($ID[$i], BitOR($SHGSI_ICON, $SHGSI_SMALLICON)
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^
D:\My Documents\AutoIt\TVExplorer\TVExplorer.au3(1404,28) : ERROR: $SIID_DRIVEFIXED: undeclared global variable.
$ID[0] = $SIID_DRIVEFIXED
~~~~~~~~~~~~~~~~~~~~~~~~~^
D:\My Documents\AutoIt\TVExplorer\TVExplorer.au3(1405,29) : ERROR: $SIID_DRIVEREMOVE: undeclared global variable.
$ID[1] = $SIID_DRIVEREMOVE
~~~~~~~~~~~~~~~~~~~~~~~~~~^
D:\My Documents\AutoIt\TVExplorer\TVExplorer.au3(1406,26) : ERROR: $SIID_DRIVERAM: undeclared global variable.
$ID[2] = $SIID_DRIVERAM
~~~~~~~~~~~~~~~~~~~~~~~^
D:\My Documents\AutoIt\TVExplorer\TVExplorer.au3(1407,25) : ERROR: $SIID_DRIVECD: undeclared global variable.
$ID[3] = $SIID_DRIVECD
~~~~~~~~~~~~~~~~~~~~~~^
D:\My Documents\AutoIt\TVExplorer\TVExplorer.au3(1408,26) : ERROR: $SIID_DRIVENET: undeclared global variable.
$ID[4] = $SIID_DRIVENET
~~~~~~~~~~~~~~~~~~~~~~~^
D:\My Documents\AutoIt\TVExplorer\TVExplorer.au3 - 20 error(s), 20 warning(s)
!>21:38:19 AU3Check ended. Press F4 to jump to next error.rc:2
>Exit code: 0 Time: 0.530

So I added the #include <APIConstants.au3> as he suggested above:

#Include <GUIConstantsEx.au3>
#Include <APIConstants.au3>
#Include <WinAPIEx.au3>
#Include <GUITreeView.au3>
#Include <TVExplorer.au3>
#Include <TreeViewConstants.au3>
#Include <WindowsConstants.au3>

But I still end up with 1 error that won't let me run the examples:

>"C:\Program Files (x86)\AutoIt3\SciTE\AutoIt3Wrapper\AutoIt3Wrapper.exe" /prod /AU3Check /in "D:\My Documents\AutoIt\TVExplorer\TVExplorer_Ex.au3"
+>21:47:01 Starting AutoIt3Wrapper v.2.1.0.33 Environment(Language:0409 Keyboard:00000409 OS:WIN_7/Service Pack 1 CPU:X64 OS:X64)
>Running AU3Check (1.54.22.0) from:C:\Program Files (x86)\AutoIt3
C:\Program Files (x86)\AutoIt3\Include\ImageListConstants.au3(12,40) : ERROR: $E_INVALIDARG previously declared as a 'Const'.
Global Const $E_INVALIDARG = 0x80070057
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^
D:\My Documents\AutoIt\TVExplorer\TVExplorer_Ex.au3 - 1 error(s), 0 warning(s)
!>21:47:02 AU3Check ended. Press F4 to jump to next error.rc:2
>Exit code: 0 Time: 1.097

I could comment out the offending line in either of the includes but then I'd be afraid of breaking something else - I'm using AutoIt 3.3.8.0, (tried 3.3.8.1, didn't make any difference), Win7 x64.

Is there a better fix available than just commenting out the line?

Thanks for any help.

Share this post


Link to post
Share on other sites

Unfortunately no.

I once had the same problem that a constant was defined in two include files. You have to comment out one of them. If they have the same value assigned then it shouldn't be a problem for your scripts.


My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (2018-12-03 - Version 1.4.11.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX (NEW 2019-03-02 - Version 1.3.5.0) - Download - General Help & Support - Example Scripts - Wiki
Outlook Tools (2019-01-22 - Version 0.1.0.0) - Download - General Help & Support
ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts
PowerPoint (2017-06-06 - Version 0.0.5.0) - Download - General Help & Support
Excel - Example Scripts - Wiki
Word - Wiki
 
Tutorials:

ADO - Wiki

 

Share this post


Link to post
Share on other sites

Thanks water, I'll move the modified include into the source directory so it doesn't screw up other things.

Share this post


Link to post
Share on other sites
:D

My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (2018-12-03 - Version 1.4.11.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX (NEW 2019-03-02 - Version 1.3.5.0) - Download - General Help & Support - Example Scripts - Wiki
Outlook Tools (2019-01-22 - Version 0.1.0.0) - Download - General Help & Support
ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts
PowerPoint (2017-06-06 - Version 0.0.5.0) - Download - General Help & Support
Excel - Example Scripts - Wiki
Word - Wiki
 
Tutorials:

ADO - Wiki

 

Share this post


Link to post
Share on other sites

I'm trying to add a 'tristate' to this udf

but i'm not having success!

would be good to add that in the next version, if i get news i post here!

p.s: very nice udf, thanks for sharing!

Edited by darkshark

Share this post


Link to post
Share on other sites

ModemJunki,

Look at posts #12 and 13 - that should give you a clue. :)

M23


Public_Domain.png.2d871819fcb9957cf44f4514551a2935.png Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind

Open spoiler to see my UDFs:

Spoiler

ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

Share this post


Link to post
Share on other sites

Share this post


Link to post
Share on other sites

Hi Yashied,

I want to add the path @DesktopDir to the ListView but i can not find a normal way how to do it with your UDF..

I did it in very horrible way.. i did it with help from your example in

http://www.autoitscript.com/forum/topic/124430-display-on-the-fly-a-directory-tree-in-a-treeview/

this is what i did:

#Include <GUIConstantsEx.au3>
#Include <GUITreeView.au3>
#Include <TVExplorer.au3>
#Include <TreeViewConstants.au3>
#Include <WindowsConstants.au3>
#Include <WinAPIEx.au3>
#Include <Array.au3>
#AutoIt3Wrapper_Run_AU3Check=n

;~ Opt('MustDeclareVars', 1)

Global $hForm , $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, 736, -1, -1, BitOR($GUI_SS_DEFAULT_GUI, $WS_MAXIMIZEBOX, $WS_SIZEBOX), $Style)
GUISetIcon(@WindowsDir & '\explorer.exe')
$hListViewInput = GUICtrlCreateInput('', 20, 378, 660, 19)

GUICtrlSetState(-1, $GUI_DISABLE)
$hListView = _GUICtrlTVExplorer_Create('', 20, 406, 660, 310, -1, $WS_EX_CLIENTEDGE, -1, '_TVEvent')
_TVSetPath($hListViewInput, _GUICtrlTVExplorer_GetSelected($hListView))
;~ _TV_Update("D:\Games", $hListView)
;~ _GUICtrlTVExplorer_AttachFolder($hListView, "D:\Games")

_TVUpdate($hListView,_GUICtrlTreeView_AddChild($hListView, 0,@DesktopDir, 0, 0) ) ; < =========== this is what i want to do - to add the path @DesktopDir to the list

;~ _TV_AddShortcut(1, $hListView, "D:\Games")

;~ _TV_Index($hListViewInput)

_GUICtrlTVExplorer_SetExplorerStyle($hListView)






;~ For $i = 0 To 2
;~  ConsoleWrite(_GUICtrlTVExplorer_GetSelected($hTV[$i])&@CRLF)
;~     _TVSetPath($Input[$i], _GUICtrlTVExplorer_GetSelected($hTV[$i]))
;~     _GUICtrlTVExplorer_SetExplorerStyle($hTV[$i])
;~ Next
GUISetState()





While 1
;~  ToolTip(_TV_Index($hListViewInput))
    Switch _GUICtrlTVExplorer_GetMsg()
        Case $GUI_EVENT_CLOSE
            GUIDelete()
            _GUICtrlTVExplorer_DestroyAll()
            Exit
        Case $TV_NOTIFY_SELCHANGED
            _TVSetPath($hListViewInput, $sPath)
    EndSwitch
WEnd

Func _TVEvent($hWnd, $iMsg, $sPath, $hItem)
    Switch $iMsg
        Case $TV_NOTIFY_SELCHANGED
            _TVSetPath($hListViewInput, $sPath)
    EndSwitch
EndFunc   ;==>_TVEvent

Func _TVSetPath($iInput, $sPath)
;~  ConsoleWrite($sPath&@CRLF)
    Local $Text = _WinAPI_PathCompactPath(GUICtrlGetHandle($iInput), $sPath, -2)

    If GUICtrlRead($iInput) <> $Text Then
        GUICtrlSetData($iInput, $Text)
    EndIf
EndFunc   ;==>_TVSetPath





; ========================================== Functions from:  http://www.autoitscript.com/forum/topic/124430-display-on-the-fly-a-directory-tree-in-a-treeview/  ==========================

Func _TVUpdate($hTV, $hItem)
    Local $hImageList = _SendMessage($hTV, $TVM_GETIMAGELIST)
    Local $Path = StringRegExpReplace(_TVGetPath($hTV, $hItem, "\"), '\\+\Z', '')
    ;ConsoleWrite($Path&@CRLF)
    Local $var = StringSplit($Path,"\",1)
    Local $foldername = $var[$var[0]]
    Local $Excluded[8] = [7, "$Recycle.Bin", "Documents and Settings", 'MSOCache', "PerfLogs", "ProgramData", "Recovery" , "System Volume Information"]
    If _ArraySearch($Excluded,$foldername,1) > 0 Then Return 0
    ;If DirGetSize($Path) = 0 Then Return 1
    Local $hSearch, $hIcon, $Index, $File

    $hSearch = FileFindFirstFile($Path & '\*')
    If $hSearch = -1 Then
        If Not @error Then
            If FileExists($Path) Then
;               If _WinAPI_PathIsDirectory($Path) Then
;                   ; Access denied
;               EndIf
            Else
                Return 0
            EndIf
        EndIf
    Else
        While 1
            $File = FileFindNextFile($hSearch)
            If @error Then
                ExitLoop
            EndIf
            ;If DirGetSize($Path) = 0 Then Return 0

            If @extended Then
                _GUICtrlTreeView_AddChild($hTV, $hItem, $File, 0, 0)

            EndIf
        WEnd
        FileClose($hSearch)
        ;ConsoleWrite($File&@CRLF)
    EndIf
    Return 1
EndFunc   ;==>_TVUpdate


Func _TVGetPath($hTV, $hItem, $sRoot)
    Local $Path = StringRegExpReplace(_GUICtrlTreeView_GetTree($hTV, $hItem), '([|]+)|(\\[|])', '\\')
    If Not $Path Then
        Return ''
    EndIf
    If Not StringInStr($Path, ':') Then
        Return StringRegExpReplace($sRoot, '(\\[^\\]*(\\|)+)\Z', '\\') & $Path
    EndIf
    Return $Path
EndFunc   ;==>_TVGetPath

In your UDF i tried _GUICtrlTVExplorer_AttachFolder and this function works but it deletes all other items in the list..

 

Please help me.

Thanks


Thank you so much for existing, Autoit and it's community is awesome and gave me very much!
I am so grateful so I contributed 100$ because I feel that this is the right thing to do  :)
If anyone also thinks that he should contribute because he benefits from Autoit, I suggest doing the same

Share this post


Link to post
Share on other sites

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  

  • Similar Content

    • By Burgs
      Hello,
        I am having great difficulty with something I would have thought to be fairly easy.  I have an array containing (military) organization strings, similar to this:
      42nd Battalion
       Company A
        1st Platoon
         1st Squad
         2nd Squad
         3rd Squad
        2nd Platoon
         ...1st, 2nd, 3rd Squad
        3rd Platoon
        ...1st, 2nd, 3rd Squad
       Company B
        ...etc...
      I also have an associated array that contains the 'hierarchy' information associated with each string..."0", "1","2", etc   ...therefore using example above the "0" would associate with "42nd Battalion", while "1" would be "Company A", "2" is "1st Platoon", etc.  Each sequential number is a 'child' of the preceding number.  Therefore the information above would appear in the array as "0", "1", "2", "3", "3", "3", "2", "3", "3", "3", "2", "3", "3", "3", "1", etc...
        My issue is that I'm having great difficulty creating a 'Treeview' control using this information.  Mainly due to the fact that entries can, and will...repeat (for example multiple entries for "Company A", "Company B", "1st Platoon", "1st Squad", etc, etc).  The following code is operative, however it does not create the treeview items as 'child' entries of one another...it simply lists each item as a separate entity.
      For $_populate = 0 to Ubound($_HIERARCHY) - 1 _GUICtrlTreeView_BeginUpdate($idTreeView) _GUICtrlTreeView_Add($idTreeView, $_HIERARCHY[$_populate], String($_STRUCTURES[$_populate])) _GUICtrlTreeView_EndUpdate($idTreeView) Next ;Next $_populate, cycle thru '$_HIERARCHY' array to build 'TREEVIEW' Controls As I mentioned earlier I thought I could manage this...however i'm pulling out quite a bit of my hair trying to get this working properly...any help would be appreciated.  I thank you in advance. 
       
    • By xtcislove
      Hello,
      i stuck again,
      Im using this function to create a treeview from root dir.
       
      ;https://autoit.de/index.php?thread/86082-treeview-root-verbergen/&postID=691139#post691139 #include <File.au3> #include <WindowsConstants.au3> Global $sPath = @ScriptDir Global $hGui = GUICreate('TreeView-Example', 400, 600) Global $idTreeView = GUICtrlCreateTreeView(10, 10, 380, 580, Default, $WS_EX_CLIENTEDGE) GUISetState() _CreatePath($sPath, $idTreeView) Do Until GUIGetMsg() = -3 Func _CreatePath($sPath, $idParent) Local $aFolder, $aFiles, $idItem If StringRight($sPath, 1) <> '\' Then $sPath &= '\' $aFolder = _FileListToArray($sPath, '*', $FLTA_FOLDERS) If Not @error Then For $i = 1 To $aFolder[0] $idItem = GUICtrlCreateTreeViewItem($aFolder[$i], $idParent) _CreatePath($sPath & $aFolder[$i], $idItem) Next EndIf $aFiles = _FileListToArray($sPath, '*', $FLTA_FILES) If @error Then Return For $i = 1 To $aFiles[0] $idItem = GUICtrlCreateTreeViewItem($aFiles[$i], $idParent) Next EndFunc Folder Structure:

      Folder1
      Folder2
      Folder3
      If a file exists in multiple folders, i like to color it red, if not green. 

      I know how to do this for files, but nut for the folders.

      Because if there is only 1 file in Folder2 that is also in Folder1 that it should only color this single file red, inlcuding its whole tree.

      The Folder1 and Folder2 should be red in this case, too. Other files and trees should stay green.
       
      Edit:
      Basically i like to color a file and its belonging tree red if the file exists more than 1 time.
    • By xtcislove
      Hello,

      im searching like 6 hours and i didnt found the right solution.

      Im trying to build a treeview from a directory and its subfolders etc.

      This function give me right treeview, but i cant color each item seperated.

       
      #include <GuiTreeView.au3> $hGui = GUICreate("Demo1", 600, 400) $hTreeView = _GUICtrlTreeView_Create($hGui, 10, 10, 580, 380) GUISetState() _GUICtrlTreeView_BeginUpdate($hTreeView) ListFiles_ToTreeView(@ScriptDir, 0) _GUICtrlTreeView_EndUpdate($hTreeView) Do Until GUIGetMsg() = -3 Func ListFiles_ToTreeView($sSourceFolder, $hItem) Local $sFile ; Force a trailing \ If StringRight($sSourceFolder, 1) <> "\" Then $sSourceFolder &= "\" ; Start the search Local $hSearch = FileFindFirstFile($sSourceFolder & "*.*") ; If no files found then return If $hSearch = -1 Then Return ; This is where we break the recursive loop <<<<<<<<<<<<<<<<<<<<<<<<<< ; Now run through the contents of the folder While 1 ; Get next match $sFile = FileFindNextFile($hSearch) ; If no more files then close search handle and return If @error Then ExitLoop ; This is where we break the recursive loop <<<<<<<<<<<<<<<<<<<<<<<<<< ; Check if a folder If @extended Then ; If so then call the function recursively ListFiles_ToTreeView($sSourceFolder & $sFile, _GUICtrlTreeView_AddChild($hTreeView, $hItem, $sFile)) Else ; If a file than write path and name _GUICtrlTreeView_AddChild($hTreeView, $hItem, $sFile) EndIf WEnd ; Close search handle FileClose($hSearch) EndFunc ;==>ListFiles_ToTreeView
      So i am searching for the exact same function just with
      GUICtrlCreateTreeViewItem
      instead of 
      _GUICtrlTreeView_AddChild
       
      Ps: i have a folder structure where i like to color each item green if a file only exist once and red if it exist more than once.

      Could someone help?
       
      Solution:

       
       
    • By Sven-Seyfert
      Hi Community,

      I have a problem with the usage of _GUICtrlTreeView_AddChild and setting different item text colors (and different background colors), separately for the TreeView levels.

      I use the UDF GUITreeViewEx.au3 of 'Melba23' and I renamed the functions to increase my understanding about the content. I already talked to him about his UDF to respect his rights and intellectual property. I read many forum threads, I tried many ways to get it, but it's seems to be impossible in the way that I use the UDF.

      Question:
      How can I set different item text colors, separately for the TreeView levels?
      How can I set different item background colors, separately for the TreeView levels?

      I found out that _GUICtrlTreeView_AddChild don't let my set this properties directly. But after loading the TreeView content I can't change the items (children) too. Only the font weight to bold I could set with _GUICtrlTreeView_SetBold but I want to do this in a generic way directly at the creation (loading) of the TreeView.

      Of course I tried the different functions to set text color or bkgColor, but it didn't work - maybe I do it wrong.
      I really hope you can help me, give me a hint and understand what I want to do.
      [Solved] final solution made by @LarsJ (see below)

      Thanks for your help - I'm grateful!
      Sven

      CODE
      BEFORE
      AFTER
      ExecutionPlan.zip
    • By gillesg
      Hello,
      I am struggling in merging GUITreeViewEx, Shelltristate and enhancing to handle a third state that means : some items under are selected.
      I have difficulties handling expand order and key Space (especially when node is collapsed).
      Here the zip with UDF and and example.
       
      The problem I might need some advice to handle : 
      1- When load Treeview, have a correct settings of the checkbox for a tristate tree
      2 - Handle keyboard used for walking in tree
           Chicken is checked and  Steak is unchecked
          When walking with arrow to Meat, it gets unchecked
      3 - When node is collapsed and checked thru keyboard (space)
         the middle state is possible which should not
      Here is joined an animated gif showing the 3 problems
       
      Thanks for your advices
       
       
       
       
       
       
       
       
       
       
       

      GUITreeview3Ex.zip
×
×
  • Create New...