Results 1 to 12 of 12

Thread: fill directory structure into treeview from local or ftp

  1. #1

    Thread Starter
    PowerPoster
    Join Date
    Dec 2004
    Posts
    25,618

    fill directory structure into treeview from local or ftp

    this developed from a thread in vb6,
    http://www.vbforums.com/showthread.php?t=649217
    and i was pleased enough with the results i decided to move it to code bank

    any recursive directory search is slow, even on the local machine, as it has to test every file to see if it is a folder

    i am sure there would be better ways to do it, you only have to look at the way firefox ftp addin does it

    to improve speed, it should be possible to only populate the root, then populate each of the nodes as they are opened, here is modified code, also solves unique key issue

    for those who did not see the original thread
    both sh as object and pathsep as string, need to be declared globally for the code to work correctly, feel free to change this if you do not like using global variables
    vb Code:
    1. Private Sub filltree()
    2.       Dim nod As Object, n As Object, initdir As Variant
    3.       If Not sh Is Nothing Then Exit Sub
    4.       pathsep = "\"  'declare globally
    5.       initdir = "ftp://username:[email protected]"
    6.       'initdir = "c:\"
    7.       If InStr(initdir, "/") > 0 Then pathsep = "/"
    8.       Set sh = CreateObject("shell.application")
    9.       Set n = sh.namespace(initdir)
    10.       If Not Right(initdir, 1) = pathsep Then initdir = initdir & pathsep
    11.       Set nod = tv.Nodes.Add(, , initdir, n.self.Name)
    12.       listdirs n, nod
    13.       nod.Expanded = True
    14.       End Sub
    15.  
    16.       Sub listdirs(f As Object, nod As Object)
    17.       Dim nod2 As Object, fitem As Object, i As Integer
    18.       If f Is Nothing Then Exit Sub
    19.       For Each fitem In f.items
    20.           If fitem.isfolder Then
    21.               Set nod2 = tv.Nodes.Add(nod, tvwChild, nod.Key & fitem.Name & pathsep, fitem.Name)
    22.       '        listdirs sh.namespace(fitem), nod2
    23.           End If
    24.           DoEvents
    25.       Next
    26.       End Sub
    27.        
    28.       Private Sub tv_NodeClick(ByVal Node As MSComctlLib.Node)
    29.       If Node.Children > 0 Then Node.Expanded = True: Exit Sub
    30.       listdirs sh.namespace(Node.Key), Node
    31.       Node.Expanded = True
    32.       End Sub

    the advantage here to using a shell object is you can use for either local of FTP folders and can start the tree from any level as supplied in initdir

    as you might note i did this using late binding, you can add a reference to shell controls and automation, then change your variables to appropriate types, no other APIs or references are required, except treeview (tv) change name to suit

    change ftp host, username and password as required

    i tested on local harddrive runs seemlessly, pretty bloody good on ftp, even with very slow connection
    i did some editing after pasting, so hope no errors

    i am certain that similar code can be used with the ftp APIs to produce identical results for ftp, if desired
    Last edited by westconn1; May 9th, 2011 at 04:58 AM.
    i do my best to test code works before i post it, but sometimes am unable to do so for some reason, and usually say so if this is the case.
    Note code snippets posted are just that and do not include error handling that is required in real world applications, but avoid On Error Resume Next

    dim all variables as required as often i have done so elsewhere in my code but only posted the relevant part

    come back and mark your original post as resolved if your problem is fixed
    pete

  2. #2

    Thread Starter
    PowerPoster
    Join Date
    Dec 2004
    Posts
    25,618

    Re: fill directory structure into treeview from local or ftp

    for the purists amongst us and cos someone challenged me here is as API version to do the same (ftp only)

    i found unless i reopened the ftp connection, enumerating the files failed to find any,
    any improvements welcomed

    all ftp code courtesy of allapi, just rearranged
    module
    vb Code:
    1. Const FTP_TRANSFER_TYPE_UNKNOWN = &H0
    2. Const FTP_TRANSFER_TYPE_ASCII = &H1
    3. Const FTP_TRANSFER_TYPE_BINARY = &H2
    4. Const INTERNET_DEFAULT_FTP_PORT = 21               ' default for FTP servers
    5. Const INTERNET_SERVICE_FTP = 1
    6. Const INTERNET_FLAG_PASSIVE = &H8000000            ' used for FTP connections
    7. Const INTERNET_OPEN_TYPE_PRECONFIG = 0                    ' use registry configuration
    8. Const INTERNET_OPEN_TYPE_DIRECT = 1                        ' direct to net
    9. Const INTERNET_OPEN_TYPE_PROXY = 3                         ' via named proxy
    10. Const INTERNET_OPEN_TYPE_PRECONFIG_WITH_NO_AUTOPROXY = 4   ' prevent using java/script/INS
    11. Const MAX_PATH = 260
    12. Private Type FILETIME
    13.     dwLowDateTime As Long
    14.     dwHighDateTime As Long
    15. End Type
    16. Private Type WIN32_FIND_DATA
    17.     dwFileAttributes As Long
    18.     ftCreationTime As FILETIME
    19.     ftLastAccessTime As FILETIME
    20.     ftLastWriteTime As FILETIME
    21.     nFileSizeHigh As Long
    22.     nFileSizeLow As Long
    23.     dwReserved0 As Long
    24.     dwReserved1 As Long
    25.     cFileName As String * MAX_PATH
    26.     cAlternate As String * 14
    27. End Type
    28. Private Declare Function InternetCloseHandle Lib "wininet" (ByRef hInet As Long) As Long
    29. Private Declare Function InternetConnect Lib "wininet.dll" Alias "InternetConnectA" (ByVal hInternetSession As Long, ByVal sServerName As String, ByVal nServerPort As Integer, ByVal sUserName As String, ByVal sPassword As String, ByVal lService As Long, ByVal lFlags As Long, ByVal lContext As Long) As Long
    30. Private Declare Function InternetOpen Lib "wininet.dll" Alias "InternetOpenA" (ByVal sAgent As String, ByVal lAccessType As Long, ByVal sProxyName As String, ByVal sProxyBypass As String, ByVal lFlags As Long) As Long
    31. Private Declare Function FtpSetCurrentDirectory Lib "wininet.dll" Alias "FtpSetCurrentDirectoryA" (ByVal hFtpSession As Long, ByVal lpszDirectory As String) As Boolean
    32. Private Declare Function FtpGetCurrentDirectory Lib "wininet.dll" Alias "FtpGetCurrentDirectoryA" (ByVal hFtpSession As Long, ByVal lpszCurrentDirectory As String, lpdwCurrentDirectory As Long) As Long
    33. Private Declare Function FtpCreateDirectory Lib "wininet.dll" Alias "FtpCreateDirectoryA" (ByVal hFtpSession As Long, ByVal lpszDirectory As String) As Boolean
    34. Private Declare Function FtpRemoveDirectory Lib "wininet.dll" Alias "FtpRemoveDirectoryA" (ByVal hFtpSession As Long, ByVal lpszDirectory As String) As Boolean
    35. Private Declare Function FtpDeleteFile Lib "wininet.dll" Alias "FtpDeleteFileA" (ByVal hFtpSession As Long, ByVal lpszFileName As String) As Boolean
    36. Private Declare Function FtpRenameFile Lib "wininet.dll" Alias "FtpRenameFileA" (ByVal hFtpSession As Long, ByVal lpszExisting As String, ByVal lpszNew As String) As Boolean
    37. Private Declare Function FtpGetFile Lib "wininet.dll" Alias "FtpGetFileA" (ByVal hConnect As Long, ByVal lpszRemoteFile As String, ByVal lpszNewFile As String, ByVal fFailIfExists As Long, ByVal dwFlagsAndAttributes As Long, ByVal dwFlags As Long, ByRef dwContext As Long) As Boolean
    38. Private Declare Function FtpPutFile Lib "wininet.dll" Alias "FtpPutFileA" (ByVal hConnect As Long, ByVal lpszLocalFile As String, ByVal lpszNewRemoteFile As String, ByVal dwFlags As Long, ByVal dwContext As Long) As Boolean
    39. Private Declare Function InternetGetLastResponseInfo Lib "wininet.dll" Alias "InternetGetLastResponseInfoA" (lpdwError As Long, ByVal lpszBuffer As String, lpdwBufferLength As Long) As Boolean
    40. Private Declare Function FtpFindFirstFile Lib "wininet.dll" Alias "FtpFindFirstFileA" (ByVal hFtpSession As Long, ByVal lpszSearchFile As String, lpFindFileData As WIN32_FIND_DATA, ByVal dwFlags As Long, ByVal dwContent As Long) As Long
    41. Private Declare Function InternetFindNextFile Lib "wininet.dll" Alias "InternetFindNextFileA" (ByVal hFind As Long, lpvFindData As WIN32_FIND_DATA) As Long
    42. Const PassiveConnection As Boolean = True
    43. Public hConnection As Long, hOpen As Long, sOrgPath  As String, pathsep As String
    44.  
    45. Public Sub Enumdirs(tv As TreeView, nod As node)
    46.     Dim pData As WIN32_FIND_DATA, hFind As Long, lRet As Long
    47.     'set the graphics mode to persistent
    48. '    Me.AutoRedraw = True
    49.     'create a buffer
    50.     pData.cFileName = String(MAX_PATH, 0)
    51.     'find the first file
    52.     hFind = FtpFindFirstFile(hConnection, "*.*", pData, 0, 0)
    53.     'if there's no file, then exit sub
    54.     If hFind = 0 Then Exit Sub
    55.     'show the filename
    56. '    Me.Print Left(pData.cFileName, InStr(1, pData.cFileName, String(1, 0), vbBinaryCompare) - 1)
    57.     Do
    58.         'create a buffer
    59.         pData.cFileName = String(MAX_PATH, 0)
    60.         'find the next file
    61.         lRet = InternetFindNextFile(hFind, pData)
    62.         'if there's no next file, exit do
    63.         If pData.dwFileAttributes And vbDirectory Then
    64.             tv.Nodes.Add nod, tvwChild, nod.Key & pathsep & cut(pData.cFileName), cut(pData.cFileName)
    65.         End If
    66.         If lRet = 0 Then Exit Do
    67.         'show the filename
    68. '        Me.Print Left(pData.cFileName, InStr(1, pData.cFileName, String(1, 0), vbBinaryCompare) - 1)
    69.     Loop
    70.     'close the search handle
    71.     InternetCloseHandle hFind
    72. End Sub
    73. Sub ShowError()
    74.     Dim lErr As Long, sErr As String, lenBuf As Long
    75.     'get the required buffer size
    76.     InternetGetLastResponseInfo lErr, sErr, lenBuf
    77.     'create a buffer
    78.     sErr = String(lenBuf, 0)
    79.     'retrieve the last respons info
    80.     InternetGetLastResponseInfo lErr, sErr, lenBuf
    81.     'show the last response info
    82.     MsgBox "Error " + CStr(lErr) + ": " + sErr, vbOKOnly + vbCritical
    83. End Sub
    84. Function cut(p As String) As String
    85. cut = Left(p, InStr(p, Chr(0)) - 1)
    86. End Function
    87. Function setdir(hcon As Long, pth As String) As Boolean
    88.     setdir = FtpSetCurrentDirectory(hConnection, pth) = 1
    89. End Function
    90. Function getdir()
    91. Dim scurpath As String
    92.         scurpath = String(MAX_PATH, 0)
    93.     'get the directory
    94.     FtpGetCurrentDirectory hConnection, scurpath, Len(scurpath)
    95.     getdir = cut(scurpath)
    96. End Function
    97.  
    98. Function openftp() As Boolean
    99.     server =
    100.     user =
    101.     pass =
    102.     'open an internet connection
    103.     hOpen = InternetOpen("API-Guide sample program", INTERNET_OPEN_TYPE_PRECONFIG, vbNullString, vbNullString, 0)
    104.     'connect to the FTP server
    105.     hConnection = InternetConnect(hOpen, server, INTERNET_DEFAULT_FTP_PORT, user, pass, INTERNET_SERVICE_FTP, IIf(PassiveConnection, INTERNET_FLAG_PASSIVE, 0), 0)
    106.     'create a buffer to store the original directory
    107.     sOrgPath = String(MAX_PATH, 0)
    108.     'get the directory
    109.     FtpGetCurrentDirectory hConnection, sOrgPath, Len(sOrgPath)
    110.     If Len(cut(sOrgPath)) > o Then openftp = True
    111. End Function
    112.  
    113. Sub closeftp()
    114.     'close the FTP connection
    115.     InternetCloseHandle hConnection
    116.     'close the internet connection
    117.     InternetCloseHandle hOpen
    118.  
    119. End Sub
    form with treeview (tv), change name to suit
    vb Code:
    1. Private Sub tv_NodeClick(ByVal node As MSComctlLib.node)
    2. If node.Children > 0 Then node.Expanded = True: Exit Sub
    3. 'listdirs sh.namespace(node.Key), node
    4. If openftp Then
    5.     If setdir(hConnection, node.Key) Then Enumdirs tv, node
    6.     closeftp
    7. End If
    8.  
    9. node.Expanded = True
    10. End Sub
    11.  
    12. Private Sub filltree()
    13. Dim nod As node, scurdir As String
    14. pathsep = "/"
    15. If openftp Then
    16.     scurdir = getdir
    17.     Set nod = tv.Nodes.Add(, , scurdir, scurdir)
    18.     Enumdirs tv, nod
    19.     closeftp
    20.     Else: MsgBox "ftp failed to connect"
    21. End If
    22. nod.Expanded = True
    23. End Sub
    Last edited by westconn1; May 8th, 2011 at 05:26 AM.
    i do my best to test code works before i post it, but sometimes am unable to do so for some reason, and usually say so if this is the case.
    Note code snippets posted are just that and do not include error handling that is required in real world applications, but avoid On Error Resume Next

    dim all variables as required as often i have done so elsewhere in my code but only posted the relevant part

    come back and mark your original post as resolved if your problem is fixed
    pete

  3. #3
    Fanatic Member
    Join Date
    Dec 2007
    Location
    West Yorkshire, UK
    Posts
    791

    Re: fill directory structure into treeview from local or ftp

    This is almost exactly what I need. I'm trying to make a treeview of a folder with several subfolders and subfolders of subfolders which this does perfectly. Now I also need to be able to list and access the files within those subfolders in the treeview. I've tried and tried and have to admit that this is beyond me. The next challenge and improvement to the code would be the above. It seems to me that it should be quite simple but I just can't manage it. Any ideas?

  4. #4

    Thread Starter
    PowerPoster
    Join Date
    Dec 2004
    Posts
    25,618

    Re: fill directory structure into treeview from local or ftp

    i have modified the code to list files as well
    what you want to do with files when clicked?
    i have just displayed msgbox
    tested only briefly
    vb Code:
    1. Sub listdirs(f As Object, nod As Object)
    2.           Dim nod2 As Object, fitem As Object, i As Integer
    3.           If f Is Nothing Then Exit Sub
    4.           For Each fitem In f.Items
    5.               If fitem.IsFolder Then
    6.                   Set nod2 = tv.Nodes.Add(nod, tvwChild, nod.Key & fitem.Name & pathsep, fitem.Name)
    7.                 Else   ' add file
    8.                   tv.Nodes.Add nod, tvwChild, nod.Key & fitem.Name, fitem.Name
    9.           '        listdirs sh.namespace(fitem), nod2
    10.               End If
    11.               DoEvents
    12.           Next
    13.           End Sub
    14.            
    15.           Private Sub tv_NodeClick(ByVal Node As MSComctlLib.Node)
    16.           If Node.Children > 0 Then Node.Expanded = True: Exit Sub
    17.           If Right(Node.Key, 1) = pathsep Then
    18.           listdirs sh.NameSpace(Node.Key), Node
    19.           Else
    20.             MsgBox "this is a file " & node.key
    21.           End If
    22.           Node.Expanded = True
    23.           End Sub
    it was pretty easy to add this functionality, but, note apart from the code in this thread, i have never used a treeview, so some improvements could be possible
    Last edited by westconn1; Oct 27th, 2011 at 05:40 AM.
    i do my best to test code works before i post it, but sometimes am unable to do so for some reason, and usually say so if this is the case.
    Note code snippets posted are just that and do not include error handling that is required in real world applications, but avoid On Error Resume Next

    dim all variables as required as often i have done so elsewhere in my code but only posted the relevant part

    come back and mark your original post as resolved if your problem is fixed
    pete

  5. #5
    Fanatic Member
    Join Date
    Dec 2007
    Location
    West Yorkshire, UK
    Posts
    791

    Re: fill directory structure into treeview from local or ftp

    Hi Westconn. I'll compare the two versions to see how you made the difference. This is quite a learning curve for me.
    What I have is a directory with a list of English audio samples for teaching English. They come from different sources - relating to different textbooks. Each can have a sub directory for CD1, CD2, CD3 etc and under those, the list of tracks on each CD. I want to click on a track and play it. I have already got WMP working, with lots of research on this forum I might add and your update to your code works well.
    There is only one problem though. When you displa the msgbox, Node.Key does not include the file extension (Which may be .mp3, .wav or .wma". I get an error message saying "the file you are trying to play has an extension (.) that doesn't coincide with the format of the file...".
    Is there a way to append the filetype to Node.key?

  6. #6

    Thread Starter
    PowerPoster
    Join Date
    Dec 2004
    Posts
    25,618

    Re: fill directory structure into treeview from local or ftp

    Node.Key does not include the file extension (Which may be .mp3, .wav or .wma". I get an error message saying "the file you are trying to play has an extension (.) that doesn't coincide with the format of the file...".
    i do not know why you have this problem, i definitely get the file extension in the message box, i have retested this morning on different computer, with correct result

    the only thing i can think of, as this uses a shell object, is if you have file extensions for known file types not displayed in explorer windows, they are also not returned with the filename in the shell object
    tested this and appears to be the case, so try changing line 8 to
    vb Code:
    1. tv.Nodes.Add nod, tvwChild, fitem.path, fitem.Name
    i do my best to test code works before i post it, but sometimes am unable to do so for some reason, and usually say so if this is the case.
    Note code snippets posted are just that and do not include error handling that is required in real world applications, but avoid On Error Resume Next

    dim all variables as required as often i have done so elsewhere in my code but only posted the relevant part

    come back and mark your original post as resolved if your problem is fixed
    pete

  7. #7
    Fanatic Member
    Join Date
    Dec 2007
    Location
    West Yorkshire, UK
    Posts
    791

    Re: fill directory structure into treeview from local or ftp

    That is perfect. Thank you very much Westconn. I know it looks like you've done all the work and I've just copied the code, but rest assured, I will examine it in detail and learn from it.

  8. #8
    PowerPoster
    Join Date
    Jan 2008
    Posts
    11,074

    Re: fill directory structure into treeview from local or ftp

    Two problems with your last addition

    You have the following code

    Code:
    Private Sub tv_NodeClick(ByVal Node As MSComctlLib.Node)
     If Node.Children > 0 Then Node.Expanded = True: Exit Sub
              
     If Right(Node.Key, 1) = pathsep Then
       listdirs sh.NameSpace(Node.Key), Node
     Else
       MsgBox "this is a file " & Node.Key
     End If
              
     Node.Expanded = True
    End Sub
    1)
    Here you check if directory name (which was clicked on in the treeview) has a "/" on the end of the line:

    If Right(Node.Key, 1) = pathsep

    However, shouldn't everything be a directory name since the treeview only contains directory names and the name was clicked on as a treeview node. So why the check? Also, the names do not end with a "/" so control goes to the Else clause which is incorrect.

    2)
    In the 1st If clause you have this:

    listdirs sh.NameSpace(Node.Key), Node

    but sh.NameSpace() causes error 91 object variable or With block not set. I see no where in the code where it is set.
    Am I supposed to set this to something?

    And yes, I added a reference to Microsoft Shell Controls and Automation


    Anything I post is an example only and is not intended to be the only solution, the total solution nor the final solution to your request nor do I claim that it is. If you find it useful then it is entirely up to you to make whatever changes necessary you feel are adequate for your purposes.

  9. #9
    PowerPoster
    Join Date
    Jan 2008
    Posts
    11,074

    Re: fill directory structure into treeview from local or ftp

    Two problems with your last addition

    You have the following code

    Code:
    Private Sub tv_NodeClick(ByVal Node As MSComctlLib.Node)
     If Node.Children > 0 Then Node.Expanded = True: Exit Sub
              
     If Right(Node.Key, 1) = pathsep Then
       listdirs sh.NameSpace(Node.Key), Node
     Else
       MsgBox "this is a file " & Node.Key
     End If
              
     Node.Expanded = True
    End Sub
    1)
    Here you check if directory name (which was clicked on in the treeview) has a "/" on the end of the line:

    If Right(Node.Key, 1) = pathsep

    However, shouldn't everything be a directory name since the treeview only contains directory names and the name was clicked on as a treeview node. So why the check? Also, the names do not end with a "/" so control goes to the Else clause which is incorrect.

    2)
    In the 1st If clause you have this:

    listdirs sh.NameSpace(Node.Key), Node

    but sh.NameSpace() causes error 91 object variable or With block not set. I see no where in the code where it is set.
    Am I supposed to set this to something?

    And yes, I added a reference to Microsoft Shell Controls and Automation

    EDIT: OK, I added this line in Form_Load():

    Set sh = CreateObject("shell.application")

    This appears to take care of the 2nd issue stated above. But now it creates another issue. When it calls:

    listdirs sh.NameSpace(Node.Key), Node but in sub listdirs:

    Sub listdirs(f As Object, nod As Object)

    f is always Nothing


    Anything I post is an example only and is not intended to be the only solution, the total solution nor the final solution to your request nor do I claim that it is. If you find it useful then it is entirely up to you to make whatever changes necessary you feel are adequate for your purposes.

  10. #10

    Thread Starter
    PowerPoster
    Join Date
    Dec 2004
    Posts
    25,618

    Re: fill directory structure into treeview from local or ftp

    1)
    Here you check if directory name (which was clicked on in the treeview) has a "/" on the end of the line:
    this code is from post #4, read the preamble to post #4, if you are not interested in files at all then you do not need the code from post #4, but if you use that code from post #4, you should use all the code from that post


    EDIT: OK, I added this line in Form_Load():
    this should not have been required, as it is taken care of in filltree procedure (see post #1), which is needed for other reasons as well, and could in turn be called from formload, a command button or any other event or procedure

    i retested the code from posts #1 and 4 together, created a new project, copied and pasted code from here, all worked correctly, without error,
    but i decided i did not like the way the directories and files loaded into the treeview nodes, so i modified as below, by this method the files could either be loaded into the treeview after the directories, or treated absolutely separately to do whatever, or ignored completely

    Code:
        Sub listdirs(f As Object, nod As Object)
                  Dim nod2 As Object, fitem As Object, i As Integer
                  If f Is Nothing Then Exit Sub
                  ' list all folders first
                  For Each fitem In f.items
                      If fitem.isfolder Then Set nod2 = tv.Nodes.Add(nod, tvwChild, nod.Key & fitem.Name & pathsep, fitem.Name)
                      ' note the above adds pathsep to node key for folders
                  Next
                  For Each fitem In f.items
    
                        If Not fitem.isfolder Then tv.Nodes.Add nod, tvwChild, nod.Key & fitem.Name, fitem.Name
                        ' the above line can be replaced, to put the files into any other controls
                       ' or this entire second for loop can be commented out
                  Next
                  End Sub
    reposted here for completeness in this thread
    i do my best to test code works before i post it, but sometimes am unable to do so for some reason, and usually say so if this is the case.
    Note code snippets posted are just that and do not include error handling that is required in real world applications, but avoid On Error Resume Next

    dim all variables as required as often i have done so elsewhere in my code but only posted the relevant part

    come back and mark your original post as resolved if your problem is fixed
    pete

  11. #11
    PowerPoster
    Join Date
    Jan 2008
    Posts
    11,074

    Re: fill directory structure into treeview from local or ftp

    I appreciate all the effort and the code you put together and I must say it is the best I have come across so far and I just wish I had enough knowledge to re-write it so as not to use internal functions or whatever is used behind the scenes. As good as it is I have the same problem with it as I do with those using APIs like those from the Inet family and they just fall short of retrieving all the directories and files. This seems to be a problem with the internal elements (be it Inet APIs or Shell Object) and not the code of the programmer. The only way around this dilemma is to write raw code getting the first directory returned by the FTP Site and start there looking for sub directories within that directory and keep drilling down until I have retrieved all inner sub directories. I know this means using a recursive sub which I have never really done one correctly but I guess I will have to learn.

    Using raw code I can inspect the returned listings looking for hidden files and directory pointers which is exactly what the other approaches fail to do.

    OK, do you know of any code that uses recursive directory searching without the aide of APIs, etc. OK if not. I will try to figure out what steps I need to take and build upon that.

    Again, thanks, westconn, I still think your above two methods are great


    Anything I post is an example only and is not intended to be the only solution, the total solution nor the final solution to your request nor do I claim that it is. If you find it useful then it is entirely up to you to make whatever changes necessary you feel are adequate for your purposes.

  12. #12

    Thread Starter
    PowerPoster
    Join Date
    Dec 2004
    Posts
    25,618

    Re: fill directory structure into treeview from local or ftp

    after some searching, i believe you are correct, the only way to retrieve hidden files etc, is to use a client /server type application based on winsock control or dll, there is some example using the dll here http://www.vbforums.com/showthread.p...=1#post4296109
    or a basic winsock ftp http://www.a1vbcode.com/app-3000.asp

    edit:
    i tested the sample program linked, with some minor change the code will return all files including hidden, but some more changes would be needed to complete the modification as a working sample
    Last edited by westconn1; Sep 1st, 2015 at 05:26 AM.
    i do my best to test code works before i post it, but sometimes am unable to do so for some reason, and usually say so if this is the case.
    Note code snippets posted are just that and do not include error handling that is required in real world applications, but avoid On Error Resume Next

    dim all variables as required as often i have done so elsewhere in my code but only posted the relevant part

    come back and mark your original post as resolved if your problem is fixed
    pete

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width