Re: Determining System Directories ??
From: songie D (songie_at_d.com)
Date: Fri, 21 May 2004 19:35:57 +0100
You don't need 'String * 255' AND WinDir = Space(255).
"Wes Spikes" <MornThdr@NOSPAMverizon.net> wrote in message
> I don't know of such in VB, but I do know of an API call that works for
> Declare Function GetWindowsDirectory Lib "kernel32" Alias
> "GetWindowsDirectoryA" (ByVal lpBuffer As String, ByVal nSize As Long) As
> You can use it like this:
> Dim WinDir As String * 255
> Dim gwdRet As Long
> WinDir = Space(255)
> gwdRet = GetWindowsDirectory(WinDir,Len(WinDir))
> If gwdRet = 0 Then
> 'there is an error using the API call that you must deal with, to get
> ' you should be able to use GetLastError, but I'm not sure on what errors
> ' GetWindowsDirectory returns!
> End If
> WinDir = Trim(WinDir)
> Hope this helps, and sorry to any potential repliers who might say that
> something might be redundant, i'm improving this (except for the API
> declaration, I'm not a genius <g>)!
> "JSE" <email@example.com> wrote in message
> > Hello everyone.
> > Is there a function or variable available in Visual Basic that an
> > application
> > can read to determine the name of the current Windows directory. We
> > the application to be able to search for a file in the windows root
> > directory, but
> > what is its name? c:\winnt c:\windows c:\mysys it could be
> > Is there a VB option for finding this?
> > (something App.Path giving the current application directory).
> > Thanks very much.
> > John Edgar