ايران ويج

نسخه‌ی کامل: کمک در نوشتن کد
شما در حال مشاهده‌ی نسخه‌ی متنی این صفحه می‌باشید. مشاهده‌ی نسخه‌ی کامل با قالب بندی مناسب.
دوستان کسی میتونه سورس کدی رو که وقتی وارد پوشه ای میشم اگه فایلی به نام ali.txt داخل اون پوشه وجود داشت پیغام بده، معرفی کنه یا بنویسه
اول يه تايمر توي فرم قرار بده و اينترول اون رو 500 بده بعد كد زير رو توي قسمت جنرال فرم كپي كن

کد:
Private Declare Function FindWindow Lib "user32" Alias "FindWindowA" (ByVal lpClassName As String, ByVal lpWindowName As String) As Long
Private Declare Function FindWindowEx Lib "user32" Alias "FindWindowExA" (ByVal hWnd1 As Long, ByVal hWnd2 As Long, ByVal lpsz1 As String, ByVal lpsz2 As String) As Long
Private Declare Function SendMessageByString Lib "user32" Alias "SendMessageA" (ByVal hwnd As Long, ByVal wMsg As Long, ByVal wParam As Long, ByVal lParam As String) As Long
Const WM_GETTEXT = &HD
Dim Address As String
Private Sub Timer1_Timer()
On Error Resume Next
Dim hwnd As Long
Dim i As Integer
Dim Temp As String
hwnd = FindWindow("CabinetWClass", vbNullString)
If hwnd <> 0 Then
hwnd = FindWindowEx(hwnd, 0, "WorkerW", vbNullString)
hwnd = FindWindowEx(hwnd, 0, "ReBarWindow32", vbNullString)
hwnd = FindWindowEx(hwnd, 0, "ComboBoxEx32", vbNullString)
Dim r As Long
Dim s As String
s = String(201, Chr(0))
r = SendMessageByString(hwnd, WM_GETTEXT, 200, s)
If Left(s, r) = "My Computer" Then Exit Sub
Address = Left(s, r)
Temp = Address & "Ali.txt"
End If
If Dir(Temp) <> "" Then MsgBox "Found: " & Temp
End Sub