|
-
Jan 7th, 2002, 10:45 PM
#1
Thread Starter
New Member
Terminating a running application
Hello. I need to terminate a running process/application given its ".exe" name. I found the FindWindow API but its parameter is the application name and not the ".exe" name (for example, "Notepad - Untitled" instead of "notepad.exe". I also tried using TerminateProcess API but it can only terminate a process created by CreateProcess API. I need help badly.
-
Jan 8th, 2002, 02:33 AM
#2
Go to this site and u will find the solution to your problem .
http://www.blackbeltvb.com/
-
Jan 8th, 2002, 02:58 AM
#3
Thread Starter
New Member
Thank you for your response. If you are referring to the module using TerminateProcess API then that is not what I need. As I said, TerminateProcess can only kill applications created either by shell function of CreateProcess API. The application that I am supposed to terminate is NOT created/run through shell function or CreateProcess but by an independent application.
-
Jan 8th, 2002, 08:52 AM
#4
VB Code:
Private Declare Function FindWindow Lib "user32" Alias "FindWindowA" (ByVal lpClassName As String, ByVal lpWindowName As String) As Long
Private Declare Function PostMessage Lib "user32" Alias "PostMessageA" (ByVal hwnd As Long, ByVal wMsg As Long, ByVal wParam As Long, ByVal lParam As Long) As Long
Private Const WM_CLOSE = &H10
Private Sub cmdCloseApp_Click()
Dim CloseIt As Long
CloseIt = FindWindow(vbNullString, "Caption Of Window To Be Closed")
PostMessage CloseIt, WM_CLOSE, CLng(0), CLng(0)
End Sub
-
Jan 8th, 2002, 10:38 PM
#5
Thread Starter
New Member
Thanks again for the reply. I cant use FindWindow either because the applicatio I am suppose to terminate has NO WINDOW. I need something that can close an application given its ".exe" name.
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
|