|
-
May 1st, 2007, 10:37 AM
#1
Thread Starter
Lively Member
Killing .exe's
Hello friends, let's say from my program, A, I want to kill another program, B. Does the kill function from A work if B is running?
Also if not then is there any way in which I can unload/exit B from my program A and kill it? Thanks for all the help!
-
May 1st, 2007, 10:39 AM
#2
Re: Killing .exe's
By kill it you simply mean stopping it from running right?
Or, are you asking how to delete it altogether?
-
May 1st, 2007, 11:54 AM
#3
Re: Killing .exe's
Why do you need one program to "killl" the other?
VB/Office Guru™ (AKA: Gangsta Yoda™ ®)
I dont answer coding questions via PM. Please post a thread in the appropriate forum. 
Microsoft MVP 2006-2011
Office Development FAQ (C#, VB.NET, VB 6, VBA)
Senior Jedi Software Engineer MCP (VB 6 & .NET), BSEE, CET
If a post has helped you then Please Rate it! 
• Reps & Rating Posts • VS.NET on Vista • Multiple .NET Framework Versions • Office Primary Interop Assemblies • VB/Office Guru™ Word SpellChecker™.NET • VB/Office Guru™ Word SpellChecker™ VB6 • VB.NET Attributes Ex. • Outlook Global Address List • API Viewer utility • .NET API Viewer Utility •
System: Intel i7 6850K, Geforce GTX1060, Samsung M.2 1 TB & SATA 500 GB, 32 GBs DDR4 3300 Quad Channel RAM, 2 Viewsonic 24" LCDs, Windows 10, Office 2016, VS 2019, VB6 SP6 
-
May 1st, 2007, 01:16 PM
#4
Thread Starter
Lively Member
Re: Killing .exe's
I want to stop the other program from running and delete it. Is it possible?
-
May 1st, 2007, 01:16 PM
#5
Re: Killing .exe's
What is this other program?
Does it belong to you?
-
May 1st, 2007, 01:32 PM
#6
Thread Starter
Lively Member
Re: Killing .exe's
Yes it does belong to me.
-
May 1st, 2007, 01:33 PM
#7
Re: Killing .exe's
Does it have a static window caption?
-
May 1st, 2007, 01:36 PM
#8
Thread Starter
Lively Member
Re: Killing .exe's
What is a static window caption? Do you mean is it shown on the window task bar?
If so, yes it's shown in the windows task manager and the task bar.
-
May 1st, 2007, 01:38 PM
#9
Re: Killing .exe's
I'm referring to the text in its own caption bar, at the top of the form.
And, by static, I mean does it remain constant, or does it, under certain, circumstances, change?
I ask these questions because to close it, you can use the FindWindow API which would require its caption. That would give you the window handle.
Once you had the Window handle, you can pass it a shutdown message.
-
May 1st, 2007, 01:40 PM
#10
Re: Killing .exe's
Here is an example:
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 lngCloseIt As Long
lngCloseIt = FindWindow(vbNullString, "Caption Of Window To Be Closed")
PostMessage lngCloseIt, WM_CLOSE, CLng(0), CLng(0)
End Sub
-
May 1st, 2007, 01:58 PM
#11
Re: Killing .exe's
You should also check if its a parent window because if its not then it wont close the app.
VB/Office Guru™ (AKA: Gangsta Yoda™ ®)
I dont answer coding questions via PM. Please post a thread in the appropriate forum. 
Microsoft MVP 2006-2011
Office Development FAQ (C#, VB.NET, VB 6, VBA)
Senior Jedi Software Engineer MCP (VB 6 & .NET), BSEE, CET
If a post has helped you then Please Rate it! 
• Reps & Rating Posts • VS.NET on Vista • Multiple .NET Framework Versions • Office Primary Interop Assemblies • VB/Office Guru™ Word SpellChecker™.NET • VB/Office Guru™ Word SpellChecker™ VB6 • VB.NET Attributes Ex. • Outlook Global Address List • API Viewer utility • .NET API Viewer Utility •
System: Intel i7 6850K, Geforce GTX1060, Samsung M.2 1 TB & SATA 500 GB, 32 GBs DDR4 3300 Quad Channel RAM, 2 Viewsonic 24" LCDs, Windows 10, Office 2016, VS 2019, VB6 SP6 
-
May 1st, 2007, 08:01 PM
#12
Member
Re: Killing .exe's
Is it possible to kill a process without using the window caption, or would I have to use an API to discover all the open apps, and select the one to kill. This would be useful for me, so that I can close firefox, but have all the tabs still there when I re-open it.
-
May 2nd, 2007, 01:26 AM
#13
Re: Killing .exe's
Yes, you can do it by the process name instead. Search the forums for Terminate Process.
VB/Office Guru™ (AKA: Gangsta Yoda™ ®)
I dont answer coding questions via PM. Please post a thread in the appropriate forum. 
Microsoft MVP 2006-2011
Office Development FAQ (C#, VB.NET, VB 6, VBA)
Senior Jedi Software Engineer MCP (VB 6 & .NET), BSEE, CET
If a post has helped you then Please Rate it! 
• Reps & Rating Posts • VS.NET on Vista • Multiple .NET Framework Versions • Office Primary Interop Assemblies • VB/Office Guru™ Word SpellChecker™.NET • VB/Office Guru™ Word SpellChecker™ VB6 • VB.NET Attributes Ex. • Outlook Global Address List • API Viewer utility • .NET API Viewer Utility •
System: Intel i7 6850K, Geforce GTX1060, Samsung M.2 1 TB & SATA 500 GB, 32 GBs DDR4 3300 Quad Channel RAM, 2 Viewsonic 24" LCDs, Windows 10, Office 2016, VS 2019, VB6 SP6 
-
May 2nd, 2007, 04:32 AM
#14
Lively Member
Re: Killing .exe's
See this post, it contains some information on TerminateProcess API:
http://www.vbforums.com/showthread.php?t=464389
If, somehow, I help you, please rate the post using the scales icon in the left bar <----  .
Please Use Naming Conventions in your projects! ------\/
http://www.visibleprogress.com/vb_na...onventions.htm
Me to Brother
-Hey, look at this avater I made in about 5 seconds
-What, morrisons?
-AGHHHHHH
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
|