كود فيجوال بيسك لإغلاق برنامج حسب العنوان
هذا الكود لإغلاق مفكرة
هذا الكود لإغلاق مفكرة
- الكود:
'in Mudele
Declare Function FindWindow Lib "user32" Alias "FindWindowA" (ByVal lpClassName As String,ByVal lpWindowName As String) As Long
Declare Function PostMessage Lib "user32" Alias "PostMessageA" (ByVal hwnd As Long,ByVal wMsg As Long,ByVal wParam As Long,lParam As Any) As Long
Public Const WM_CLOSE = &H10
'In Command
Dim winHwnd As Long
Dim RetVal As Long
winHwnd = FindWindow(vbNullString, "Notepad")
Debug.Print winHwnd
If winHwnd <> 0 Then
RetVal = PostMessage(winHwnd, WM_CLOSE, 0&, 0&)
If RetVal = 0 Then
MsgBox "خطأ في عملية ارسال الرسالة"
End If
Else
MsgBox "الدفتر مفتوح"
End If