Results 1 to 14 of 14

Thread: [RESOLVED] Drive List Control For Network Drives

  1. #1

    Thread Starter
    Frenzied Member
    Join Date
    Aug 2006
    Posts
    1,806

    Resolved [RESOLVED] Drive List Control For Network Drives

    Hi Peeps,

    I have a VB 6 application which runs on a terminal server. The client runs the application through a remote desktop connection. I need to create a form that allows the user to select a local image and upload it to a user profile location on the terminal server.

    Any ideas please?

    Jiggy!

  2. #2
    Frenzied Member
    Join Date
    Mar 2008
    Posts
    1,210

    Re: Drive List Control For Network Drives

    There is nothing very special about running an app on a 'Terminal Server'.

    A Terminal Server is similar to a Workstation in that it can host multiple user accounts. The key difference is that it allows a remote desktop connection to more than one of those accounts concurrently. A Workstation will only allow one remote desktop connection (ie. to one account) at a time.
    So copying stuff from anywhere to anywhere on a Terminal Server is little different to doing the same thing on a Workstation providing the current user has access permissions to do it.

  3. #3

    Thread Starter
    Frenzied Member
    Join Date
    Aug 2006
    Posts
    1,806

    Re: Drive List Control For Network Drives

    Hi,

    Thanks for that; what I can't get to work is the viewing of local drives. So I run my app and in the remote desktop I have made available my local drive C but when I load the app and view the drive dialog I only get the drives that are local on the terminal server. I have even tried using the API getlogicaldrives and that does the same.

    You see I want the user to select a file locally (their drive C or USB drive etc) and click on a copy button the copy button would then copy the file from their drive C to there user profile / image folder.

    Thanks again,

    Jiggy!

  4. #4
    Frenzied Member
    Join Date
    Mar 2008
    Posts
    1,210

    Re: Drive List Control For Network Drives

    >their drive C

    Will be THE C drive on the Terminal Server which all users share, they do not have a C drive each. Any other drives directly connected to the server will be shared in a similar manner. It is just the same as a normal pc except that more than one user account can be active at a time. Typically all users connect to the server with a remote desktop connection because the Server machine will only have a single keyboard/ screen and so only facilitates use by one user at a time. Some Servers have no keyboard or screen.

  5. #5

    Thread Starter
    Frenzied Member
    Join Date
    Aug 2006
    Posts
    1,806

    Re: Drive List Control For Network Drives

    Hi,

    I don't think I am making myself clear. Yes the drive C they see is the terminal server drive. When you setup a remote desktop connection you can share local drives. It is these drives I want to show on screen which are the drives the person who has connected. So I my PC is Jiggy when I connect I share Jiggy-C as local source. If I then load up explorer I can see Jiggy-C as a UNC path. I need to show these drives so the user can select an image on their local drive and copy it to the C:\profile area on the terminal server.

    Thanks again,

    Jiggy!

  6. #6

    Thread Starter
    Frenzied Member
    Join Date
    Aug 2006
    Posts
    1,806

    Re: Drive List Control For Network Drives

    What is also strange is if I look in explorer in my windows xp virtual machine I see the local drives and all the drives available in Windows 7. If I run my app all I see are the phisical drives (A,C,D). Here is the code:-

    Code:
    ' this api is to find out what type of drive is denoted by each drive letter
    Private Declare Function GetDriveType Lib "kernel32.dll" Alias "GetDriveTypeA" (ByVal nDrive As String) As Long
    ' this api is to find all the existing drive letters
    Private Declare Function GetLogicalDrives Lib "kernel32.dll" () As Long
    
    
    
    Private Sub cmdExit_Click()
        
    Dim lvar, AllDrives, DriveType As Long
    Dim NetworkDrive As String
    
    ' get list of drive letters and store in variable AllDrives
    AllDrives = GetLogicalDrives()
    iResult = MsgBox(AllDrives)
    
    ' loop thru 26 alphabets
    For lvar = 0 To 25
       ' if current alphabet exists as drive letter then,
       If (AllDrives And (2 ^ lvar)) = (2 ^ lvar) Then
           ' find out what type of drive the drive letter denotes
           DriveType = GetDriveType(Chr(97 + lvar) & ":\")
              
           ' based on what type of drive it is, add it to respective group
           NetworkDrive = NetworkDrive & UCase(Chr(97 + lvar)) & ":,"
    
       End If
              MsgBox "HERE"
    
    Next
    
    Text1.Text = NetworkDrive
       
    End Sub

  7. #7

    Thread Starter
    Frenzied Member
    Join Date
    Aug 2006
    Posts
    1,806

    Re: Drive List Control For Network Drives

    I now know why the above go is not work; it is because my other drivers a unc drives. Does anyone know how I can list these please?

    Thank you,

    Jiggy!

  8. #8
    Frenzied Member
    Join Date
    Mar 2008
    Posts
    1,210

    Re: Drive List Control For Network Drives

    The C drive installed on the pc client is mapped to \\tsclient\C when in a Remote Destop session with the Terminal server and so;

    Private Sub Form_Load()
    File1.Path = "\\tsclient\C\Windows"
    End Sub

    will list the files on the current users pc c drive when it run inside the remote desktop window.

    I'm not quite sure how it goes if you want to copy something from your \\tsclient\C to another users \\tsclient\C though.

  9. #9
    Frenzied Member
    Join Date
    Mar 2008
    Posts
    1,210

    Re: Drive List Control For Network Drives

    >Does anyone know how I can list these please?

    Map them to drive letters.

  10. #10

    Thread Starter
    Frenzied Member
    Join Date
    Aug 2006
    Posts
    1,806

    Re: Drive List Control For Network Drives

    I understand that but they may also have mapped network drives or unc drives so I want to allow them to select the relevant drive and then folder and then file. Once again thanks for the input. The code above is not working because it is looking for drive letters and these are unc drives.

  11. #11
    Frenzied Member
    Join Date
    Mar 2008
    Posts
    1,210

    Re: Drive List Control For Network Drives

    >unc drives

    are not drives as such they are shared locations on the network with 'Public' names. They may represent a complete physical drive or more commonly just a Folder or Folder tree on a physical drive. So unless you map the shares to drive letters you may need selection lists of shares/ folders/ files rather than Drives/ folders/ files.

  12. #12

    Thread Starter
    Frenzied Member
    Join Date
    Aug 2006
    Posts
    1,806

    Re: Drive List Control For Network Drives

    Thank you Magic; yes you are correct they are shared folders \\tsclient\c etc. So I need to detect which shared folders are available; any clues please?

    Regards,

    Jiggy!

  13. #13
    Frenzied Member
    Join Date
    Mar 2008
    Posts
    1,210

    Re: Drive List Control For Network Drives

    This may interest you;

    Code:
    'may fail if WMI service is disabled
        On Error GoTo eh                                                                                                                       
       'Type 0 = Disk drive, 2147483648 = Disk drive admin
        For Each share In GetObject("winmgmts:\\.\root\cimv2").ExecQuery("SELECT * FROM Win32_Share Where Type = 0 Or Type = 2147483648")
           On Error GoTo 0
            MsgBox share.Name & " " & share.Path & " " & share.Type
            'on XP the Share.Path is only returned if the user is an Admin
        Next
    It should list the shares defined on the local computer, it may list the shares on others if you replace '\\.\' with '\\computername\'

  14. #14

    Thread Starter
    Frenzied Member
    Join Date
    Aug 2006
    Posts
    1,806

    Re: Drive List Control For Network Drives

    Thank you very much!

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