Windows and system directory

Peperl
09-01-2003, 05:35 AM
Hi, I have a question. Is there a way to know which is the "windows directory" and the "windows\system directory?"

In XP, is Windows\System32
In Windows 98 is Windows\System
In Nt is WinNT ...

and I have to make reference to a dll to registrate it at running time ...

Ok, thanks a lot.

gundavarapu
09-01-2003, 05:47 AM
try this code...


Option Explicit


Private Const MAX_PATH = 260
Private Declare Function GetSystemDirectory Lib "kernel32" Alias "GetSystemDirectoryA" (ByVal lpBuffer As String, ByVal nSize As Long) As Long



Private Sub Command1_Click()
Dim Windows

Windows = Environ("Windir")
'Get the Windows directory from a MS-Dos Environment, stored in c:\msdos.sys

MsgBox Windows 'windows root directory

Dim strBuffer As String
Dim lngReturn As Long
Dim strWindowsSystemDirectory As String

strBuffer = Space$(MAX_PATH)
lngReturn = GetSystemDirectory(strBuffer, MAX_PATH)
strWindowsSystemDirectory = Left$(strBuffer, Len(strBuffer) - 1)

MsgBox strWindowsSystemDirectory 'system directory
End Sub


Hope this helps!

SpaceFrog
09-01-2003, 06:18 AM
With fso, allows you to retrieve other special folders ...


Set fso = New FileSystemObject
Set DossierSystem = fso.GetSpecialFolder(SystemFolder)
Set DossierTempory = fso.GetSpecialFolder(TemporaryFolder)
Set DossierWindows = fso.GetSpecialFolder(WindowsFolder)
MsgBox Dossier.Path
Set Dossier = Nothing
Set fso = Nothing

Peperl
09-02-2003, 01:56 AM
Oh, thanks very much. I tried it and it workds!

EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum