|
-
Nov 26th, 1999, 06:38 AM
#1
Thread Starter
Lively Member
How do I close a program thats running with VB? For example, if I had notepad open, how would I close it using an API?
thx...a lot
-Justin =]
-
Nov 26th, 1999, 07:16 AM
#2
Lively Member
Option Explicit
Private Const WM_CLOSE = &H10
Private Declare Function SendMessage Lib "user32" Alias "SendMessageA" (ByVal hWnd As Long, ByVal wMsg As Long, ByVal wParam As Long, lParam As Any) As Long
Private Declare Function FindWindow Lib "user32" Alias "FindWindowA" (ByVal lpClassName As String, ByVal lpWindowName As String) As Long
Private Sub CloseMirc()
Dim hNotepad As Long
hNotepad = FindWindow("mIRC32", vbNullString)
Call SendMessage(hNotepad, WM_CLOSE, 0, ByVal 0&)
End Sub
Private Sub Command1_Click()
CloseMirc
End Sub
This example shous you how to close a running program like mirc
you need to know the real name of the program like in this case (mIRC32)
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|