devxlogo

Find the Name of the Windows or Windows System Directory

Find the Name of the Windows or Windows System Directory

You can quickly find the name of the Windows or the Windows System directory. Just pass “WindowsDirectory” or “WindowsSystemDirectory” into this function:

 Declare Function wu_GetWindows_	Directory Lib "Kernel" Alias _	"GetWindowsDirectory" _	(ByVal lpBuffer As String, _	ByVal nSize As Integer) As IntegerDeclare Function wu_GetWindowsSystem_	Directory Lib "Kernel" Alias _	"GetSystemDirectory" _	(ByVal lpBuffer As String, _	ByVal nSize As Integer) As IntegerFunction WinDirs$ (strDirNameNeeded$)On Error GoTo WinDirs_ErrDim strBuffer$Dim iSize%Dim iResult%iSize = 256strBuffer$ = Space$(iSize)	Select Case strDirNameNeeded$		Case "WindowsDirectory"			iResult% = wu_GetWindows_				Directory(strBuffer$, iSize)		Case "WindowsSystemDirectory"			iResult% = wu_GetWindows_				SystemDirectory(strBuffer$, iSize)	End Select	WinDirs$ = Left$_		(strBuffer$, iResult%)WinDirs_Err:	If Err Then		' Do whatever you need to here	End IfEnd Function

devx-admin

Share the Post: