08-22-2011، 11:32 PM
(04-15-2011، 11:07 PM)پارسا نوشته: Eng:روش سادتر برای بدست اوردن مسیر ها های رزرو شده (مثلا ویندوز)
Get Windows Directories
Persian:
به دست اوردن مسیر پوشه ویندوز
کد:Option Explicit
'Visual Basic 6
'Www.ParsiCoders.com
Private Declare Function GetWindowsDirectory Lib "kernel32" Alias "GetWindowsDirectoryA" (ByVal lpBuffer As String, ByVal nSize As Long) As Long
Private Declare Function GetTempPath Lib "kernel32" Alias "GetTempPathA" (ByVal nBufferLength As Long, ByVal lpBuffer As String) As Long
Private Declare Function GetSystemDirectory Lib "kernel32" Alias "GetSystemDirectoryA" (ByVal lpBuffer As String, ByVal nSize As Long) As Long
Private Declare Function GetCurrentDirectory Lib "kernel32" Alias "GetCurrentDirectoryA" (ByVal nBufferLength As Long, ByVal lpBuffer As String) As Long
Private Sub Form_Load()
Dim WindowsDir As String
Dim SystemDir As String
Dim TempDir As String
Dim CurrentDir As String
CurrentDir = Space(256)
WindowsDir = Space(256)
SystemDir = Space(256)
TempDir = Space(256)
GetWindowsDirectory WindowsDir, Len(WindowsDir)
txtWindows.Text = WindowsDir
GetSystemDirectory SystemDir, Len(SystemDir)
txtSystem.Text = SystemDir
GetTempPath Len(TempDir), TempDir
txtTemp.Text = TempDir
GetCurrentDirectory Len(CurrentDir), CurrentDir
txtCurrent.Text = CurrentDir
End Sub
کد:
Environ ("windir")