Subscribe For Free Updates!

We'll not spam mate! We promise.

الاثنين، 7 يوليو 2014

visual basic code Close specific application know his name

Examples and codes to deal with Api  functions 

Close specific application know his name

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

Private Sub cmdClose_Click()

Dim winHwnd As Long
Dim RetVal As Long

winHwnd = FindWindow(vbNullString, Text1.Text)

Debug.Print winHwnd

If winHwnd <> 0 Then
RetVal = PostMessage(winHwnd, WM_CLOSE, 0&, 0&)
If RetVal = 0 Then
MsgBox "Error posting message."
End If
Else 
MsgBox Text1.Text + " is not open."
End If

End Sub

Interpreter and redeployed from vb4arb

Please Give Us Your 1 Minute In Sharing This Post!
SOCIALIZE IT →
FOLLOW US →
SHARE IT →
Powered By: BloggerYard.Com

0 التعليقات:

إرسال تعليق