Bulacağımız Klasörler:
* Windows klasörü !
* System32 klasörü
* Temp Klasörü
Foruma ;
3 Tane Label Ekleyin (label1 label2 label3)
1 Tane Command Buton (Command1)
Foruma Gireceğimiz Kodlar =
Private Sub Command1_Click()
Label1 = GetWinDir()
Label2 = GetTempDir()
Label3 = GetSystemDir()
End Sub
Private Function GetSystemDir() As String
Dim r As Long
Dim nSize As Long
Dim tmp As String
tmp = Space$(256)
nSize = Len(tmp)
r = GetSystemDirectory(tmp, nSize)
GetSystemDir = TrimNull(tmp)
End Function
Public Function GetTempDir() As String
Dim r As Long
Dim nSize As Long
Dim tmp As String
tmp = Space$(256)
nSize = Len(tmp)
r = GetTempPath(nSize, tmp)
GetTempDir = TrimNull(tmp)
End Function
Private Function GetWinDir() As String
Dim r As Long
Dim nSize As Long
Dim tmp As String
tmp = Space$(256)
nSize = Len(tmp)
r = GetWindowsDirectory(tmp, nSize)
GetWinDir = TrimNull(tmp)
End Function
Private Function TrimNull(item As String)
Dim pos As Integer
pos = InStr(item, Chr$(0))
If pos Then
TrimNull = Left$(item, pos - 1)
Else
TrimNull = item
End If
End Function
Ve 1 Modül Ekleyin !
Modüle Gelecek Kod =
Option Explicit
Public Declare Function GetSystemDirectory Lib "kernel32" Alias "GetSystemDirectoryA" (ByVal lpBuffer As String, ByVal nSize As Long) As Long
Public Declare Function GetTempPath Lib "kernel32" Alias "GetTempPathA" (ByVal nSize As Long, ByVal lpBuffer As String) As Long
Public Declare Function GetWindowsDirectory Lib "kernel32" Alias "GetWindowsDirectoryA" (ByVal lpBuffer As String, ByVal nSize As Long) As Long
Evet Bu kadar Butona Basınca 3 sistem Klasörünün Tam Yolu Çıcakcaktır.
Bu sayede windowsun nerde kurulduğunu ögrendik.
Ve programlarımızı bir Sistem Klasörlerine çıkaracağımızda Yanılmamızı engelliyor
* Windows klasörü !
* System32 klasörü
* Temp Klasörü
Foruma ;
3 Tane Label Ekleyin (label1 label2 label3)
1 Tane Command Buton (Command1)
Foruma Gireceğimiz Kodlar =
Private Sub Command1_Click()
Label1 = GetWinDir()
Label2 = GetTempDir()
Label3 = GetSystemDir()
End Sub
Private Function GetSystemDir() As String
Dim r As Long
Dim nSize As Long
Dim tmp As String
tmp = Space$(256)
nSize = Len(tmp)
r = GetSystemDirectory(tmp, nSize)
GetSystemDir = TrimNull(tmp)
End Function
Public Function GetTempDir() As String
Dim r As Long
Dim nSize As Long
Dim tmp As String
tmp = Space$(256)
nSize = Len(tmp)
r = GetTempPath(nSize, tmp)
GetTempDir = TrimNull(tmp)
End Function
Private Function GetWinDir() As String
Dim r As Long
Dim nSize As Long
Dim tmp As String
tmp = Space$(256)
nSize = Len(tmp)
r = GetWindowsDirectory(tmp, nSize)
GetWinDir = TrimNull(tmp)
End Function
Private Function TrimNull(item As String)
Dim pos As Integer
pos = InStr(item, Chr$(0))
If pos Then
TrimNull = Left$(item, pos - 1)
Else
TrimNull = item
End If
End Function
Ve 1 Modül Ekleyin !
Modüle Gelecek Kod =
Option Explicit
Public Declare Function GetSystemDirectory Lib "kernel32" Alias "GetSystemDirectoryA" (ByVal lpBuffer As String, ByVal nSize As Long) As Long
Public Declare Function GetTempPath Lib "kernel32" Alias "GetTempPathA" (ByVal nSize As Long, ByVal lpBuffer As String) As Long
Public Declare Function GetWindowsDirectory Lib "kernel32" Alias "GetWindowsDirectoryA" (ByVal lpBuffer As String, ByVal nSize As Long) As Long
Evet Bu kadar Butona Basınca 3 sistem Klasörünün Tam Yolu Çıcakcaktır.
Bu sayede windowsun nerde kurulduğunu ögrendik.
Ve programlarımızı bir Sistem Klasörlerine çıkaracağımızda Yanılmamızı engelliyor
