Re: Is it possible to use %SystemRoot% in code




Is it possible to use %SystemRoot% in code i.e. automatically converts to
the
Window system folder (different depending on the Windows OS version)? If
it
is possible, how is it implemement (code snippet would help)?

Taken directly from API-Guide

Private Declare Function GetSystemDirectory Lib "kernel32" Alias _
"GetSystemDirectoryA" (ByVal lpBuffer As String, _
ByVal nSize As Long) As Long

Private Sub Form_Load()
'KPD-Team 1998
'URL: http://www.allapi.net/
'E-Mail: KPDTeam@xxxxxxxxxx
Dim sSave As String, Ret As Long
'Create a buffer
sSave = Space(255)
'Get the system directory
Ret = GetSystemDirectory(sSave, 255)
'Remove all unnecessary chr$(0)'s
sSave = Left$(sSave, Ret)
'Show the windows directory
MsgBox "Windows System directory: " + sSave
End Sub


.



Relevant Pages

  • Re: "system" extension on Windows
    ... At the core of the simulation, ... ||| The problem appears on Windows XP, ... integer ret, path_len ... Initialize StartupInfo - we won't use any of its fields ...
    (comp.lang.fortran)
  • Re: API for TaskBar options
    ... Const ABS_ALWAYSONTOP As Long = &H2 ... Dim BarData As APPBARDATA, Ret As Long ... Call SHAppBarMessage(ABM_GETTASKBARPOS, BarData) ... > Can someone help me with the Windows task bar. ...
    (microsoft.public.excel.programming)
  • Problem starting windows forms application from ASP.Net 2.0
    ... I'm having trouble starting desktop windows forms application with gui. ... const int SecurityImpersonation = 2; ... ret = DuplicateTokenEx(Token,GENERIC_ALL,ref ...
    (microsoft.public.dotnet.framework.aspnet.security)
  • Re: Removing duplicated XP
    ... The road to happiness. ... Do you know why you can't spell, Ret.? ... education, perhaps? ...
    (alt.os.windows-xp)
  • Re: Is it possible to use %SystemRoot% in code
    ... Window system folder? ... how is it implemement (code snippet would help)? ... To get the Windows folder, however, a better way is probably to use the GetWindowsDirectory API function. ...
    (microsoft.public.vb.general.discussion)