Type a page name and press Enter. You'll jump to the page if it exists, or you can create it if it doesn't.
To create a page in a module other than user32, prefix the name with the module name and a period.
Declare Function ShutdownBlockReasonCreate Lib "user32.dll" (ByVal hWnd As IntPtr, <Runtime.InteropServices.MarshalAs(Runtime.InteropServices.UnmanagedType.LPWStr)> ByVal reason As String) As Boolean
Declare Function ShutdownBlockReasonCreate Lib "user32.dll" (hWnd as IntPtr, reason As String) As Boolean
User-Defined Types:
None.
Alternative Managed API:
Do you know one? Please contribute it!
Parameters:
hWnd - A handle to the main window of the application.
reason - The reason the application must block system shutdown.
Tips & Tricks:
Invisible windows won't show up in Vista's "Running Applications" dialog on shutdown/logoff and therefore the reason set with this method will not be visible to the end-user https://www.pinvoke.net/emoticons/sad_smile.gif.
Make sure you also block/delay the WM_QUERYENDSESSION message.
Please add some!
Sample Code:
IntPtr handleForShutdownBlocker = shutdownBlockingForm.Handle;
if (!ShutdownBlockReasonCreate(handleForShutdownBlocker, UIMessages.GetString("ShutdownBlockReason"))) {
// failed, log error code and handle used.
int error = Marshal.GetLastWin32Error();
log.Error(string.Format("Failed calling ShutdownBlockReasonCreate. Error code: {0}, blocking form handle: {1}", error, handleForShutdownBlocker));
}
Please add some!
Please edit this page!
Do you have...
helpful tips or sample code to share for using this API in managed code?
corrections to the existing content?
variations of the signature you want to share?
additional languages you want to include?
Select "Edit This Page" on the right hand toolbar and edit it! Or add new pages containing supporting types needed for this API (structures, delegates, and more).