Click here to Skip to main content
15,892,537 members
Please Sign up or sign in to vote.
5.00/5 (1 vote)
See more:
Dear all,

I want to close without confirm (Do you want to save the changes.... or something like that) all of open windows (appear in taskbar).
I used SendMessage(handle, WM_CLOSE, 0, 0) to do this, but if there is any application need to save, it will appear a popup to confirm (Do you want to save....?). I don't want it, I want to force to close without confirm.
I used SendMessage(handle, WM_DESTROY, 0, 0) to do this, but there are some windows are not closed.

Do you have any solution for me?

Thank you very much!
Posted

1 solution

Please use this MSDN support article to achieve what you want: How To Terminate an Application "Cleanly" in Win32[^].

In a nutshell this article uses the same approach you used with a twist though. It will wait for a certain amount of time for a process to terminate and when a process does not shutdown cleanly the TerminateProcess[^] WinAPI call is invoked to kill the process.

Cheers!

—MRB
 
Share this answer
 
v3

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