Click here to Skip to main content
15,911,142 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi All,

I have create a application "Windows Keylogger Tool". What I am doing is when someone click on close button of applicaiton what I do is

e.cancel=true
and hide the applicaiton

works fine.

But from application's exit button. When someone click on that application should exit.

Application.Exit();

I did this. Application suppose to exit. But when I see in task manager application still running.

And when I try to run exe again. It will give error.

The same window 7 error dailog box.

Check online for solution
Close the program
Debug the program

Help me.
Posted
Comments
Ankur\m/ 21-May-11 9:12am    
Press ESC button and then press Exit. Let me know if that works (I will explain the reason, if that is the case).

And yes, use reply link to reply to the comment or I don't get a notification.
Sergey Alexandrovich Kryukov 22-May-11 0:24am    
You need to show your code to get definitive solution.
--SA

I think that your code that sets 'cancel' to true, is running both times, which means that your app can never close.
 
Share this answer
 
v2
Comments
sunder.tinwar 21-May-11 9:01am    
Thanks christian. But when we call Application.Exit it will not go to form closing event. And on button click we can not set e.cancel=true.

Help me if you have better answer.
Hi sunder.tinwar,

In the Form_Closed event handler use this code :

Application.ExitThread();


I hope this help,
:)
 
Share this answer
 
Comments
sunder.tinwar 21-May-11 9:46am    
Hi michael thanks for reply but I figured out why its happening is I am starting lot of threads from my appliation. When I am closing applicaiton I need to close my threads manually then every thing will go fine for me or use Environment.Exit
Anyhow thanks.

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

  Print Answers RSS
Top Experts
Last 24hrsThis month


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