للحصول على دليل الويندوز بطريقة API

كود:



Public Declare Function GetWindowsDirectory _


Lib "kernel32" Alias "GetWindowsDirectoryA" _


(ByVal lpBuffer As String, ByVal nSize As Long) As Long




Public Function WindowsDirectory() As String


Dim St As String


Dim A As Long


A = 50


St = String(A, " ")


GetWindowsDirectory St, A


St = Trim(St)


St = Left(St, Len(St) - 1)


If Right(St, 1) <> "" Then WindowsDirectory = St + "" Else WindowsDirectory = St


End Function

Share |

معلومات إضافية