How to get into "System32" folder?
Hiya,
I want to copy my files in the "c:\windows\System\" in case of Windows98 and in the "c:\windows\System32\" if it is Windows2000.
I know there is a command verb to detect automatically the system directory (System or System32).
Where can I get such command verbs?
Re: How to get into "System32" folder?
The API for it is GetSystemDirectory. Here is its declaration:
Code:
Declare Function GetSystemDirectory Lib "kernel32" Alias "GetSystemDirectoryA" (ByVal lpBuffer As String, ByVal nSize As Long) As Long
Re: How to get into "System32" folder?
Quote:
Originally Posted by logan
The API for it is GetSystemDirectory. Here is its declaration:
Code:
Declare Function GetSystemDirectory Lib "kernel32" Alias "GetSystemDirectoryA" (ByVal lpBuffer As String, ByVal nSize As Long) As Long
Is not there a code like %USERPROFILE% to be used in VB?
If Yes, suggest me please with other such codes, too with usage.
Re: How to get into "System32" folder?
I modified the example from www.allapi.net, so that it gets the windows and the system folders.
Code:
Option Explicit
Private Declare Function GetWindowsDirectory Lib "kernel32" Alias "GetWindowsDirectoryA" (ByVal lpBuffer As String, ByVal nSize As Long) As Long
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 - modified by dglienna
'URL: http://www.allapi.net/
'E-Mail: KPDTeam@Allapi.net
Dim Path As String, strSave As String, strSave2 As String
'Create a buffer string
strSave = String(200, Chr$(0))
strSave2 = String(200, Chr$(0))
'Get the windows directory and append 'REGEdit.exe' to it
MsgBox Left$(strSave, GetWindowsDirectory(strSave, Len(strSave)))
MsgBox Left$(strSave2, GetSystemDirectory(strSave2, Len(strSave)))
End Sub
Re: How to get into "System32" folder?
Have a look at GetUserProfileDirectory. This maybe useful.