S.l.e!ep.¢%

像打了激速一样,以四倍的速度运转,开心的工作
简单、开放、平等的公司文化;尊重个性、自由与个人价值;
posts - 1098, comments - 335, trackbacks - 0, articles - 1
  C++博客 :: 首页 :: 新随笔 :: 联系 :: 聚合  :: 管理

ShutdownBlockReasonCreate Function

Posted on 2010-02-05 11:18 S.l.e!ep.¢% 阅读(641) 评论(0)  编辑 收藏 引用 所属分类: RootKit
ShutdownBlockReasonCreate Function

Indicates that the system cannot be shut down and sets a reason string to be displayed to the user if system shutdown is initiated.
在 shutdown 初始化的时候,表明系统不能关机并且设置一个理由用来显示给用户看

Syntax

C++
												BOOL WINAPI ShutdownBlockReasonCreate(
  __in  HWND hWnd,
  __in  LPCWSTR pwszReason
);
										

Parameters

hWnd [in]

A handle to the main window of the application.
指向主窗体的句柄

pwszReason [in]

The reason the application must block system shutdown. This string will be truncated for display purposes after MAX_STR_BLOCKREASON characters.

Return Value

If the call succeeds, the return value is nonzero.

If the call fails, the return value is zero. To get extended error information, call GetLastError.

Remarks

This function can only be called from the thread that created the window specified by the hWnd parameter. Otherwise, the function fails and the last error code is ERROR_ACCESS_DENIED.
这个函数只能被创建窗体的线程调用并且传 hwnd 参数,否则这个函数会失败并且返回 ERROR_ACCESS_DENIED 错误

Applications should call this function as they begin an operation that cannot be interrupted, such as burning a CD or DVD. When the operation has completed, call the ShutdownBlockReasonDestroy function to indicate that the system can be shut down.
如果应用程序开始了一个不能中断的操作,像取CD or DVD, 此时,应用程序可以调用这个函数,当操作完成时,调用
ShutDownBlockReasonDestroy() 函数指明系统可以关机了.

Because users are typically in a hurry when shutting down the system, they may spend only a few seconds looking at the shutdown reasons that are displayed by the system. Therefore, it is important that your reason strings are short and clear. For example "A CD burn is in progress." is better than "This application is blocking system shutdown because a CD burn is in progress. Do not shut down."
因为用户通常急着要关掉系统. 他们可能会花几秒钟看下系统显示的关机理由. 所以,你的‘关机理由’需要简短明了. 像 '取CD正在处理中...' 比 '这个程序阻止了系统关机,因为取CD正在处理中,不能关闭'要好得多.

Requirements

Minimum supported client Windows Vista
Minimum supported server Windows Server 2008
Header Winuser.h (include Windows.h)
Library User32.lib
DLL User32.dll

Vista & Win2008 以后的版本才支持

只有注册用户登录后才能发表评论。
网站导航: 博客园   IT新闻   BlogJava   博问   Chat2DB   管理