Results 1 to 9 of 9

Thread: Win 2k

  1. #1
    2 Star Lounger
    Join Date
    Mar 2001
    Location
    Oregon, USA
    Posts
    129
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Win 2k

    I need to copy files to the users' desktops. We have mixed Win 98 and 2k systems. It's easy to test for the OS version. I can't figure out how to find what user is logged in and what drive the OS is on so I can copy to Driveocuments and SettingsUsernameDeskTop. Any ideas?

    Thanks,

    Chris

  2. #2
    Gold Lounger
    Join Date
    Dec 2000
    Location
    Hollywood (sorta), California, USA
    Posts
    2,759
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Win 2k

    Chris,

    There are api calls to get the username as well, but this is just as good and reliable.

    <pre>vOS = Application.System.OperatingSystem

    If vOS = "Windows NT" Then 'And Win2000
    vUserName = UCase(System.PrivateProfileString(FileName:="", Section:= _
    "HKEY_CURRENT_USERSoftwareMicrosoftWindowsCurrentV ersionExplorer", Key:="Logon User Name"))
    Else
    vUserName = UCase(System.PrivateProfileString _
    (FileName:="", Section:="HKEY_LOCAL_MACHINENetworkLogon", Key:="UserName"))
    End If
    </pre>

    Kevin <IMG SRC=http://www.wopr.com/w3tuserpics/Kevin_sig.gif alt="Keep the change, ya filthy animal...">
    <img src=/w3timages/blackline.gif width=33% height=2><img src=/w3timages/redline.gif width=33% height=2><img src=/w3timages/blackline.gif width=33% height=2>

  3. #3
    2 Star Lounger
    Join Date
    Mar 2001
    Location
    Oregon, USA
    Posts
    129
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Win 2k

    Kevin,

    Verrrry cool. Thanks!

    Chris

  4. #4
    Gold Lounger
    Join Date
    Dec 2000
    Location
    Hollywood (sorta), California, USA
    Posts
    2,759
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Win 2k

    I wish I owned a hardware (software?) store. I just love a happy customer <img src=/S/yep.gif border=0 alt=yep width=15 height=15>
    Kevin <IMG SRC=http://www.wopr.com/w3tuserpics/Kevin_sig.gif alt="Keep the change, ya filthy animal...">
    <img src=/w3timages/blackline.gif width=33% height=2><img src=/w3timages/redline.gif width=33% height=2><img src=/w3timages/blackline.gif width=33% height=2>

  5. #5
    2 Star Lounger
    Join Date
    Mar 2001
    Location
    Oregon, USA
    Posts
    129
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Win 2k

    Well, now you've got a repeat customer. I'm also scratching my head a bit over testing which drive the OS is running from. I'm thinking about reading the drive from HKEY_CURRENT_USERSoftwareMicrosoftWindowsCurrentVe rsionExplorerShell FoldersFonts. It would seem pretty stable, but I dunno. <img src=/S/shrug.gif border=0 alt=shrug width=39 height=15>

    Unless you've got a better idea. <img src=/S/yep.gif border=0 alt=yep width=15 height=15>

    Thanks again,

    Chris

  6. #6
    Gold Lounger
    Join Date
    Dec 2000
    Location
    Hollywood (sorta), California, USA
    Posts
    2,759
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Win 2k

    Chris,

    I know NT/2000 creates an envar named Windir. I have not used Win98 for a while so I forget if it creates that envar.

    If so, you could use the Environ statement to find the drive letter for the Windows OS:

    strWinDrive = left$(Environ("Windir"),2)
    Kevin <IMG SRC=http://www.wopr.com/w3tuserpics/Kevin_sig.gif alt="Keep the change, ya filthy animal...">
    <img src=/w3timages/blackline.gif width=33% height=2><img src=/w3timages/redline.gif width=33% height=2><img src=/w3timages/blackline.gif width=33% height=2>

  7. #7
    Gold Lounger
    Join Date
    Dec 2000
    Location
    Hollywood (sorta), California, USA
    Posts
    2,759
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Win 2k

    You can also use an api call if you prefer:

    Declare Function GetWindowsDirectory Lib "kernel32"
    Alias "GetWindowsDirectoryA" (ByVal lpBuffer As String,
    ByVal nSize As Long) As Long
    Kevin <IMG SRC=http://www.wopr.com/w3tuserpics/Kevin_sig.gif alt="Keep the change, ya filthy animal...">
    <img src=/w3timages/blackline.gif width=33% height=2><img src=/w3timages/redline.gif width=33% height=2><img src=/w3timages/blackline.gif width=33% height=2>

  8. #8
    2 Star Lounger
    Join Date
    Mar 2001
    Location
    Oregon, USA
    Posts
    129
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Win 2k

    Oooh. Those environment variables look like fun. <img src=/S/wink.gif border=0 alt=wink width=15 height=15>

    Thanks, Kevin. Another happy customer. <img src=/S/joy.gif border=0 alt=joy width=23 height=23>

    Chris

  9. #9
    Gold Lounger
    Join Date
    Dec 2000
    Location
    Hollywood (sorta), California, USA
    Posts
    2,759
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Win 2k

    Cha ching. That cash register just keeps on chimin'
    Kevin <IMG SRC=http://www.wopr.com/w3tuserpics/Kevin_sig.gif alt="Keep the change, ya filthy animal...">
    <img src=/w3timages/blackline.gif width=33% height=2><img src=/w3timages/redline.gif width=33% height=2><img src=/w3timages/blackline.gif width=33% height=2>

Posting Permissions

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