Re: Determining System Directories ??

From: songie D (songie_at_d.com)
Date: 05/21/04


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
news:rnbrc.6970$dq4.457@nwrddc01.gnilink.net...
> I don't know of such in VB, but I do know of an API call that works for
it!
>
> Declare Function GetWindowsDirectory Lib "kernel32" Alias
> "GetWindowsDirectoryA" (ByVal lpBuffer As String, ByVal nSize As Long) As
> Long
>
> 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
more
> info
> ' 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>)!
>
> -Wes
>
>
> "JSE" <john@nospam.conwayinfo.ca> wrote in message
> news:E7arc.517475$Pk3.173476@pd7tw1no...
> > 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
want
> > 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
> anything.
> >
> > Is there a VB option for finding this?
> >
> > (something App.Path giving the current application directory).
> >
> > Thanks very much.
> >
> > John Edgar
> >
> >
> >
>
>



Relevant Pages

  • Re: [ANN] Net::LDAP 0.0.4 released
    ... > I'm also excited that you're flexible about the interface; ... which are not exactly easy to use. ... Thanks- improving the API and making it more Ruby-esque was a major ...
    (comp.lang.ruby)
  • Re: Digital-tv card drivers and API discussion
    ... The API seems to be constantly changing and improving. ... I will take a look on the most current linux api and implement FreeBSD ...
    (freebsd-arch)
  • Re: writing to ms word and compatibility
    ... there's actually a very large probability that something in the API ... send your thanks to the Redmond developers who keep ... "improving" the API with each version and assume that everyone will ...
    (comp.soft-sys.matlab)