UkonΦenφ jinΘ aplikace

Postup:
Zalo₧te nov² projekt. V modulu deklarujte:

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

Na formulß° p°idejte tlaΦφtko a na jeho udßlost click:

Dim winHwnd As Long 
Dim RetVal As Long 

winHwnd = FindWindow(vbNullString, "KalkulaΦka")
If winHwnd <> 0 Then 
   RetVal = PostMessage(winHwnd, WM_CLOSE, 0&, 0&)    If RetVal = 0 Then 
      MsgBox "Chyba p°i zasφlßnφ zprßvy." 
   End If
Else 
   MsgBox "KalkulaΦka nenφ spuÜt∞nß." 
End If

Spus¥te aplikaci. Pokud je kalkulßtor otev°en², ukonΦφ se.

Zp∞t

Autor: The Bozena