05-13-2012، 08:24 AM
Getting the Windows and System Directory
با تابع های زیر میتونید مسیر پوشه ویندوز و سیستم 32 رو بدست بیارید.
با تابع های زیر میتونید مسیر پوشه ویندوز و سیستم 32 رو بدست بیارید.
کد:
Getting the Windows and System Directory
Declare Function GetSystemDirectory Lib "kernel32" _
Alias "GetSystemDirectoryA" _
(ByVal lpBuffer As String, _
ByVal nSize As Long) As Long
Declare Function GetWindowsDirectory Lib "kernel32" _
Alias "GetWindowsDirectoryA" _
(ByVal lpBuffer As String, _
ByVal nSize As Long) As Long
Public Function GetWindowsDir() As String
Dim sDir As String * 255
Dim iReturn As Integer
Dim lSize As Long
sDir = Space$(255)
lSize = Len(sDir)
iReturn = GetWindowsDirectory(sDir, lSize)
GetWindowsDir = Left$(sDir, InStr(1, sDir, Chr$(0)) - 1)
End Function
Public Function GetSystemDir() As String
Dim sDir As String * 255
Dim iReturn As Integer
Dim lSize As Long
sDir = Space$(255)
lSize = Len(sDir)
iReturn = GetSystemDirectory(sDir, lSize)
GetSystemDir = Left$(sDir, InStr(1, sDir, Chr$(0)) - 1)
End Function