如何在没有Windows通知的情况下捕获Vista中的关机事件 [英] How to capture Shutdown event in Vista without Windows Notificiations

查看:91
本文介绍了如何在没有Windows通知的情况下捕获Vista中的关机事件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

背景:

启动时,我有一些依赖SQL的服务,但是关闭时,Microsoft并没有撤消该过程.

I have services that depend on SQL when starting up, but Microsoft doesn't reverse the process when shutting down, I know, amazing.

因此,直到Vista,我使用WinLogon注册表项编写了一个dll以获取Windows通知,因此当关闭事件触发时,在服务收到关闭事件之前,我将有更多时间关闭服务.这有助于在SQL崩溃之前关闭我的服务.

So, until Vista, I wrote a dll using the WinLogon registry entry to get Windows Notifications so when the shutdown event fired I would have additional time to shutdown my services before the services received the shutdown event.  Which helped in getting my services shutdown before SQL went down.

因此,大街上的新词是使用ICredentialProvider接口,但是我找不到任何有关在文档中获取关闭事件的信息,而且我也没有对.NET的了解!新的文档指出,您只能编写服务,很遗憾,我已经在这样做了.

So, new word on the street is use ICredentialProvider Interface, but I can't find anything about getting a shutdown event in the documentation, plus no hook for .NET, I know!!  And the new documentation states that you can just write a service, unfortunately, I'm already doing that.

有人知道解决方案吗?

Anybody know of a solution?  Any help greatly appreciated !!

推荐答案



您好...

如果是,那么我们如何捕获Windows关闭事件.如果用户想直接关闭PC而不关闭应用程序,我想对我的应用程序进行一些验证.

请帮助我.



Hello...

I have same problem like you, may be you can help me. I want to capture shut down event of windows Xp. Is that possible??
If yes then how we can capture the windows shutdown event. I want to do some validation with my application if user want to shut down the PC directily without closing the application.

Please help me.

Thanks in Advance
Ajit


这篇关于如何在没有Windows通知的情况下捕获Vista中的关机事件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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