Jump to content

TVExplorer UDF


Yashied
 Share

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)!

Link to comment
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
Link to comment
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)!

Link to comment
Share on other sites

  • 1 month later...
  • 5 months later...
  • 4 months later...

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

~ WhiteStar Magic

Always tuned to http://www.superbluesradio.com/  Tune in at http://87.117.217.41:8036/

Link to comment
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 parsing • AutoIt Search • AutoIt3 Portable • AutoIt3WrapperToPragma • AutoItWinGetTitle()/AutoItWinSetTitle() • Coding • DirToHTML5 • FileInstallr • FileReadLastChars() • GeoIP database • GUI - Only Close Button • GUI Examples • GUICtrlDeleteImage() • GUICtrlGetBkColor() • GUICtrlGetStyle() • GUIEvents • GUIGetBkColor() • Int_Parse() & Int_TryParse() • IsISBN() • LockFile() • Mapping CtrlIDs • OOP in AutoIt • ParseHeadersToSciTE() • PasswordValid • PasteBin • Posts Per Day • PreExpand • Protect Globals • Queue() • Resource Update • ResourcesEx • SciTE Jump • Settings INI • SHELLHOOK • Shunting-Yard • Signature Creator • Stack() • Stopwatch() • StringAddLF()/StringStripLF() • StringEOLToCRLF() • VSCROLL • WM_COPYDATA • More Examples...

Updated: 22/04/2018

Link to comment
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

~ WhiteStar Magic

Always tuned to http://www.superbluesradio.com/  Tune in at http://87.117.217.41:8036/

Link to comment
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 parsing • AutoIt Search • AutoIt3 Portable • AutoIt3WrapperToPragma • AutoItWinGetTitle()/AutoItWinSetTitle() • Coding • DirToHTML5 • FileInstallr • FileReadLastChars() • GeoIP database • GUI - Only Close Button • GUI Examples • GUICtrlDeleteImage() • GUICtrlGetBkColor() • GUICtrlGetStyle() • GUIEvents • GUIGetBkColor() • Int_Parse() & Int_TryParse() • IsISBN() • LockFile() • Mapping CtrlIDs • OOP in AutoIt • ParseHeadersToSciTE() • PasswordValid • PasteBin • Posts Per Day • PreExpand • Protect Globals • Queue() • Resource Update • ResourcesEx • SciTE Jump • Settings INI • SHELLHOOK • Shunting-Yard • Signature Creator • Stack() • Stopwatch() • StringAddLF()/StringStripLF() • StringEOLToCRLF() • VSCROLL • WM_COPYDATA • More Examples...

Updated: 22/04/2018

Link to comment
Share on other sites

  • 3 months later...

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.

Link to comment
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 (NEW 2022-02-19 - Version 1.6.1.0) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts
OutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - Download
Outlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - Wiki
PowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - Wiki
Task Scheduler (NEW 2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki

Standard UDFs:
Excel - Example Scripts - Wiki
Word - Wiki

Tutorials:
ADO - Wiki
WebDriver - Wiki

 

Link to comment
Share on other sites

:D

My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2022-02-19 - Version 1.6.1.0) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts
OutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - Download
Outlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - Wiki
PowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - Wiki
Task Scheduler (NEW 2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki

Standard UDFs:
Excel - Example Scripts - Wiki
Word - Wiki

Tutorials:
ADO - Wiki
WebDriver - Wiki

 

Link to comment
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
Link to comment
Share on other sites

  • 3 months later...
  • Moderators

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

 

Link to comment
Share on other sites

  • 1 year later...
Link to comment
Share on other sites

  • 5 months later...

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

Link to comment
Share on other sites

  • 8 months later...
Link to comment
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
 Share

×
×
  • Create New...