Getting the Windows and System Directory

0 comments
Source Code :
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



Related Post :



0 comments:

Post a Comment

 
VB Source Code | © 2011 Design by DheTemplate.com and Theme 2 Blog

Find more free Blogger templates at DheTemplate.com - Daily Updates Free Blogger Templates