473,400 Members | 2,145 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,400 software developers and data experts.

How can I close a running program like the Task Manager does?

I am trying to figure out the coding that on a button click it will close a specified program nicely similar to the Task Manager's "End Process." This is because sometimes when I close a program it still remains running in the task manager. I have done some research before hand into this and one method I found that was suggested was by using WM_CLOSE. However, I can't seem to get it to work as I am taking pieces of coding from several sources to help create the effect I want (which I try to avoid but when faced with a completely new concept of coding to understand this is the only way I know how.)

Any help to explain how to use this code properly, with an example, would be greatly appreciated or any other more efficient technique you would suggest would be amazing.

{I am currently using Microsoft Visual Basics 2010 Express to create my programs}
Sep 5 '14 #1
1 1462
iam_clint
1,208 Expert 1GB
If you close the form and its still running in task manager, that means that there is a thread still running. Killing the process is a sloppy fix to the issue.
But if you really must do it this way you can use system.diagnostics.process, iterate the processes or get the process by name then use the .kill method.
Oct 5 '14 #2

Sign in to post your reply or Sign up for a free account.

Similar topics

0
by: Pola | last post by:
Please Help I am using VC++ in win 2000 In my appl (Win32 project) I want to control the close operation of the apl (for example if somebody will try to close appl from the "Windows Task Manager")...
4
by: Jaans | last post by:
I have a problem that relates to running "cleanup" code when an application is forcibly ended using the "End Process" of "Task Manager" (Please note that this is very different from "End Task"...
2
by: ThunderMusic | last post by:
Hi, Is there a way in VB.NET to get the information about a task just like the Windows' task manager does? I want to get how started the task, the memory it takes, the cpu it take, the cpu time it...
6
by: rodchar | last post by:
hey all, i'm trying to use Windows' Task Manager to kick off my win form. Am I correct to say that this is not going to work because everytime it runs I see it task manager but no window ever...
2
by: Dino Buljubasic | last post by:
Hi, Does anybody know how can I close my app and remove it from Task Manager? I have an application that has a log in form and several others. User can close application from Log In form or...
10
by: shiry | last post by:
Hi, I need to do some important cleanup before my console application exists. I used the console ctrl event. This is working well and it fires for all cases, including the CTRL_CLOSE_EVENT (if I...
4
by: Strah | last post by:
Is there a way to catch the event of terminating the application from the the processes tab in task manager? I have created windows app, and if a user termintates the app in the task manager,...
0
by: hisham123 | last post by:
hi can I get all the Applications running in Task Manager (Windows Xp Professional 2002 Service Pack2) and load it in list box control in visual basic 6.0
1
by: cyberpearl | last post by:
Hi I am doing a windows application in c#. When my application closing, i am doing hide my application by overriding form closing event. so its still running in task manager. I allowed one...
2
by: sheenutech | last post by:
Hello, I am using Excel 2002 in my code. Where I open, load all the necessary data and then close Excel from VC++ code. I am using following piece of code to finally quiting Excel. ...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.