术语 | shutdownblockreasonquery |
释义 | ShutdownBlockReasonQuery 语法: C++ BOOL WINAPI ShutdownBlockReasonQuery( __in HWND hWnd, __out_opt LPWSTR pwszBuff, __inout DWORD *pcchBuff ); ShutdownBlockReasonQuery功能 检索原因字符串,ShutdownBlockReasonCreate的功能集。 参数 hWnd [in] 一个句柄,应用程序的主窗口。 pwszBuff [指出,可选] 阿一个缓冲区,它接收的原因字符串指针。如果该参数为NULL,则函数检索的字符数的原因字符串。 pcchBuff [ in , out ] 一个变量指定pwszBuff以字符缓冲区的大小,指针。如果函数成功,这个变量接收到复制到缓冲区的字符,包括空终止字符数。如果缓冲区太小,变量获得所需的缓冲区大小,以字符,不包括空终止字符。 返回值 如果调用成功,则返回值为非零值。 如果调用失败,返回值是零。为了获得更多错误信息,调用GetLastError。 备注 此功能只能调用的线程创建的hWnd参数指定的窗口。否则,函数失败,最后错误代码为ERROR_ACCESS_DENIED。 实例 下面的示例检索所需的缓冲区大小,分配,理由字符串内存,检索的原因字符串,并显示为调试输出字符串。 #include #pragma comment(lib, "User32.lib") HWND hWnd; BOOL DisplayShutdownBlockReason() { DWORD cch=0; if (ShutdownBlockReasonQuery(hWnd, NULL, &cch)) { WCHAR *pch = (WCHAR *)LocalAlloc(LMEM_FIXED, cch * sizeof(*pch)); if (NULL != pch) { if (ShutdownBlockReasonQuery(hWnd, pch, &cch)) { OutputDebugStringW(L"Shutdown block reason: "); OutputDebugStringW(pch); OutputDebugStringW(L"\\n"); } LocalFree(pch); return TRUE; } } return FALSE; } 要求: client最低支持Vista server最低支持 Windows Server 2008 HeaderWinuser.h(头文件:winuser.h) LibraryUser32.lib DLLUser32.dll 参见 ShutdownBlockReasonCreate 关机 如果有任何问题和意见,请发送给微软(wsddocfb@microsoft.com) 生成日期:2009年7月30日 ==英文原文==ShutdownBlockReasonQuery Function Retrieves the reason string set by the ShutdownBlockReasonCreate function. Syntax C++ BOOL WINAPI ShutdownBlockReasonQuery( __in HWND hWnd, __out_opt LPWSTR pwszBuff, __inout DWORD *pcchBuff ); Parameters hWnd [in] A handle to the main window of the application. pwszBuff [out, optional] A pointer to a buffer that receives the reason string. If this parameter is NULL, the function retrieves the number of characters in the reason string. pcchBuff [in, out] A pointer to a variable that specifies the size of the pwszBuff buffer, in characters. If the function succeeds, this variable receives the number of characters copied into the buffer, including the null-terminating character. If the buffer is too small, the variable receives the required buffer size, in characters, not including the null-terminating character. 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. Examples The following example retrieves the required buffer size, allocates memory for the reason string, retrieves the reason string, and displays the string as debug output. #include #pragma comment(lib, "User32.lib") HWND hWnd; BOOL DisplayShutdownBlockReason() { DWORD cch=0; if (ShutdownBlockReasonQuery(hWnd, NULL, &cch)) { WCHAR *pch = (WCHAR *)LocalAlloc(LMEM_FIXED, cch * sizeof(*pch)); if (NULL != pch) { if (ShutdownBlockReasonQuery(hWnd, pch, &cch)) { OutputDebugStringW(L"Shutdown block reason: "); OutputDebugStringW(pch); OutputDebugStringW(L"\\n"); } LocalFree(pch); return TRUE; } } return FALSE; } Requirements Minimum supported clientWindows Vista Minimum supported serverWindows Server 2008 HeaderWinuser.h (include Windows.h) LibraryUser32.lib DLLUser32.dll See Also ShutdownBlockReasonCreate Shutting Down Send comments about this topic to Microsoft Build date: 7/30/2009 ==原始网址==http://msdn.microsoft.com/en-us/library/aa376879(VS.85).aspx\n |
随便看 |
|
windows api函数参考手册包含2258条windows api函数文档,详细介绍nodejs、java、rust调用windows api的方法技巧,是学习windows api编程的入门中文文档。