Article ID: 142817
Article Last Modified on 1/8/2003
FindWindow and Visual Basic
Private Sub Command1_Click()
X% = Shell("Calc.exe")
End Sub
Private Sub Command2_Click()
Const NILL = 0&
Const WM_SYSCOMMAND = &H112
Const SC_CLOSE = &HF060
lpClassName$ = "SciCalc"
lpCaption$ = "Calculator"
'* Determine the handle to the Calculator window.
Handle = FindWindow(lpClassName$, lpCaption$)
'* Post a message to Calc to end its existence.
X& = SendMessage(Handle, WM_SYSCOMMAND, SC_CLOSE, NILL)
End Sub
' Enter each of the following Declare statements on one, single line:
Private Declare Function FindWindow% Lib "user" _
(ByVal lpClassName As Any, ByVal lpCaption As Any)
Private Declare Function SendMessage& Lib "user" _
(ByVal hwnd%, ByVal wMsg%, ByVal wParam%, ByVal lParam As Long)
Additional query words: 1.00 2.00 3.00 4.00 vb4win vb416
Keywords: KB142817