强制关闭所有打开的窗口-WinAPI [英] Force to close all of open windows - WinAPI

查看:561
本文介绍了强制关闭所有打开的窗口-WinAPI的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

亲爱的所有人,

我想关闭而不确认(是否要保存更改....或类似的东西)所有打开的窗口(出现在任务栏中).
我使用SendMessage(handle,WM_CLOSE,0,0)来执行此操作,但是如果有任何需要保存的应用程序,它将出现一个弹出窗口以确认(您要保存....?).我不想要它,我想强制关闭而不确认.
我使用SendMessage(handle,WM_DESTROY,0,0)来做到这一点,但是有些窗口没有关闭.

对我有什么解决办法吗?

非常感谢!

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!

推荐答案

请使用此MSDN支持文章来实现所需的内容: [ ^ ].

简而言之,本文使用的方法与您所使用的方法相同.它将等待一定的时间,以使进程终止,并且当进程没有彻底关闭时,
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


这篇关于强制关闭所有打开的窗口-WinAPI的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆