Click here to Skip to main content
15,881,516 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
hi all i have created a vb.net application,it will run continusly 24*7. the application cannot be closed when certain task is running in my application,how shall i do this in vb.net
Posted
Comments
Nisarg S Shah 18-Jul-12 8:49am    
You can check for the running tasks in the OnClosing event of the form and can protect the application from getting close.
Also for further protection, i.e. force quit from task manager you can also hide it from the task manager. the code for which can be easily found by googling it
Dave Kreskowiak 18-Jul-12 10:35am    
Don't EVER suggest hiding anything from Task Manager. There is never any legitimate reason to do so.
Nisarg S Shah 19-Jul-12 5:01am    
Only reason why i suggested hiding from task manager was because i thought that people should not be knowing about what application is running on their machine and the application is needed to be prepared for monitoring people's activity
Dave Kreskowiak 19-Jul-12 8:31am    
because i thought that people should not be knowing about what application is running on their machine

Oh really?? This is the dumbest reason i've heard yet. People are entitled to know about EVERY application that is running on their machine. Especially so in an age of 10's of thousands of viruses running around.
bbirajdar 18-Jul-12 9:35am    
You should post this as a solution with some references...

1 solution

In the Form.Closing event (assuming this is a Windows Forms app) of your application you can use the Process class to see if your other process is still running.

You would probably want to poll every few seconds to do this check as you don't want to cancel the app being closed, possibly stopping Windows from shutting down.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900