Re: Windows default path

Tech Tip: Click here to run a free scan for Windows Errors and optimize PC performance

From: Norm Cook (normcookNOSPAM_at_cableone.net)
Date: 09/15/04


Date: Wed, 15 Sep 2004 10:32:52 -0500

For my OS (W2K)
Debug.print Environ$("windir") and Debug.print Environ$("systemroot")
both give C:\WINNT

The API method below should work for any OS

Option Explicit
Private Declare Function GetWindowsDirectory Lib "kernel32" Alias "GetWindowsDirectoryA" (ByVal lpBuffer As String, ByVal nSize As
Long) As Long
Private Sub Form_Load()
    Dim tmp As String
    Dim r As Long
    tmp = Space$(260)
    r = GetWindowsDirectory(tmp, 260)
    Debug.Print Left$(tmp, r)
End Sub

"Marty" <reply@to.forum> wrote in message news:_NY1d.32557$XP3.16505@edtnps84...
> How do I get the windows path? For my application it is app.path, is it
> something similar for the OS path?
>
> Is it "$(WinSysPath)" ? but it doesn't work.
>
> Thanks
>
> Marty



Relevant Pages

  • Re: Muting and controlling the volume
    ... Private Declare Function waveOutSetVolume Lib "Winmm" (ByVal wDeviceID As ... Dim tmp, vol As String ...
    (microsoft.public.dotnet.languages.vb)
  • Re: looking for VB program to restart PC
    ... Michael C a écrit: ... Private Declare Function IsNetworkAlive Lib "Sensapi" _ ... Private Function IsNetConnectionAliveAs Boolean ... Dim tmp As Long ...
    (microsoft.public.vb.general.discussion)