-
February 19th, 2006, 08:06 AM
#1
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?
-
February 19th, 2006, 08:20 AM
#2
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
"I rather not play football than wear Nerrazzuri shirt" - Paolo Maldini
FORZA MILAN!!!
-
February 19th, 2006, 09:01 AM
#3
Re: How to get into "System32" folder?
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.
Last edited by naikosen; February 19th, 2006 at 09:03 AM.
-
February 19th, 2006, 10:28 AM
#4
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
-
February 19th, 2006, 11:26 AM
#5
Re: How to get into "System32" folder?
Have a look at GetUserProfileDirectory. This maybe useful.
"I rather not play football than wear Nerrazzuri shirt" - Paolo Maldini
FORZA MILAN!!!
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|