阻止用户关闭应用程序 [英] Blocking app closing by user

查看:77
本文介绍了阻止用户关闭应用程序的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述




我的应用程序执行了一些过程,应用程序无法在中途关闭。因此

我希望能够阻止任何用户关闭应用程序的尝试,例如点击关闭(交叉)或Alt-F4并且应用程序完成后点击

做什么

它正在关闭。换句话说,我需要优雅地关闭应用程序。怎么

我可以实现这个目标吗?


谢谢


问候

Hi

My app does a few processes and the app can not be closes mid way. Therefore
I want to be able to block any attempt of closing app by user such as by
clicking on close (cross) or Alt-F4 and once the app is finished doing what
it is doing to close. In other words I need to close the app gracefully. How
can I achieve this?

Thanks

Regards

推荐答案

===原始消息===

来自:John

date:23.07.2008 09:18
=== original message ===
from: John
date: 23.07.2008 09:18

我的应用程序执行了一些过程,并且应用程序无法在中途关闭。因此

我希望能够阻止任何用户关闭应用程序的尝试,例如点击关闭(交叉)或Alt-F4并且应用程序完成后点击

做什么

它正在关闭。换句话说,我需要优雅地关闭应用程序。怎么

我可以实现这个目标吗?
My app does a few processes and the app can not be closes mid way. Therefore
I want to be able to block any attempt of closing app by user such as by
clicking on close (cross) or Alt-F4 and once the app is finished doing what
it is doing to close. In other words I need to close the app gracefully. How
can I achieve this?



如果应用程序有一个主窗口:处理FormClosing事件并设置

e.Cancel = true;


否则处理windows消息并检查

WM_QUERYENDSESSION: http://msdn.microsoft.com/en-us/library/aa376890.aspx

WM_QUIT: http://msdn.microsoft.com/en-us/libr。 .41(VS.85).aspx

WM_CLOSE: http://msdn.microsoft.com/en-us/libr...17(VS.85).aspx

干杯,

Udo

If the app has a main window: handle the FormClosing event and set
e.Cancel = true;

Otherwise handle the windows messages and check for
WM_QUERYENDSESSION: http://msdn.microsoft.com/en-us/library/aa376890.aspx
WM_QUIT: http://msdn.microsoft.com/en-us/libr...41(VS.85).aspx
WM_CLOSE: http://msdn.microsoft.com/en-us/libr...17(VS.85).aspx
Cheers,
Udo


John,


不要使用取消在收盘。它会让您的用户感到不安全。禁用

关闭按钮。


当您使用Google搜索此新闻组时,您会发现很多

的实现。


Cor


" John" < in ** @ nospam.infovis.co.ukschreef in bericht

news:uo ************** @ TK2MSFTNGP06.phx.gbl ...
John,

Don''t use the cancel on the close. It makes your users insecure. Disable the
close button.

As you search this newsgroup with Google you will find a lot of
implementation for that.

Cor

"John" <in**@nospam.infovis.co.ukschreef in bericht
news:uo**************@TK2MSFTNGP06.phx.gbl...




我的应用程序执行了一些过程,应用程序无法在中途关闭。

因此,我希望能够阻止任何用户关闭应用程序的尝试

,例如点击关闭(交叉)或Alt-F4,一旦应用程序是

完成了它正在做的事情来结束。换句话说,我需要优雅地关闭应用程序
。我怎样才能实现这个目标?


谢谢


问候
Hi

My app does a few processes and the app can not be closes mid way.
Therefore I want to be able to block any attempt of closing app by user
such as by clicking on close (cross) or Alt-F4 and once the app is
finished doing what it is doing to close. In other words I need to close
the app gracefully. How can I achieve this?

Thanks

Regards


禁用关闭按钮也会禁用Alt-F4吗?


谢谢


问候


Cor Ligthert [MVP] < no ************ @ planet.nlwrote in message

新闻:F3 ****************** **************** @ microsof t.com ...
Would disabling the Close button also disable Alt-F4?

Thanks

Regards

"Cor Ligthert[MVP]" <no************@planet.nlwrote in message
news:F3**********************************@microsof t.com...

John,


不要在收盘时使用取消。它会让您的用户感到不安全。禁用

关闭按钮。


当您使用Google搜索此新闻组时,您会发现很多

的实现。


Cor


" John" < in ** @ nospam.infovis.co.ukschreef in bericht

news:uo ************** @ TK2MSFTNGP06.phx.gbl ...
John,

Don''t use the cancel on the close. It makes your users insecure. Disable
the close button.

As you search this newsgroup with Google you will find a lot of
implementation for that.

Cor

"John" <in**@nospam.infovis.co.ukschreef in bericht
news:uo**************@TK2MSFTNGP06.phx.gbl...

>嗨

我的应用程序执行了一些过程,应用程序无法在中途关闭。
因此我想要能够阻止任何用户关闭应用程序的尝试
,例如点击关闭(交叉)或Alt-F4,一旦应用程序完成它正在做的事情关闭。换句话说,我需要优雅地关闭应用程序。我怎样才能做到这一点?

感谢

>Hi

My app does a few processes and the app can not be closes mid way.
Therefore I want to be able to block any attempt of closing app by user
such as by clicking on close (cross) or Alt-F4 and once the app is
finished doing what it is doing to close. In other words I need to close
the app gracefully. How can I achieve this?

Thanks

Regards



这篇关于阻止用户关闭应用程序的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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