Desktop Functions: ![]() Smart Device Functions:
|
SHMessageBoxCheck (shlwapi)
C# Signature:
/* The SHMessageBoxCheck() function is a Windows Shell API function that displays a custom messagebox with a "never ask me again" check box. When the user checks the checkbox, the dialog never shows up again. The shell API .dll exports this function by ordinal only. The entrypoint is ordinal 185 for ASCII and 191 for unicode. */ VB Signature:
Declare Function SHMessageBoxCheck Lib "shlwapi.dll" (TODO) As TODO User-Defined Types:None. Alternative Managed API:I had to set PreserveSig=true in order to get this to work. Without it, I would receive a PInvokeStackImbalance exception from MDA. Notes:
/* We use the Windows Shell function SHMessageBoxCheck, so we have to define this parallel enum of the definitions in winuser.h. */ The Windows Shell (Explorer) stores your preference in the following registry key:
HKEY_CURRENT_USER One problem: If you have an application that you must uninstall, how do you remove this key for all users? For example, suppose users X and Y have checked the "Do not show me this dialog again" checkbox. Now user X uninstalls the program. The installer would need to be able to go into user Y's registry settings to remove the registry key, which may not be possible depending on system permissions. I don't know how to solve this problem. Tips & Tricks:Note the discussion on what to do when you have multiple dialog options, like YES/NO and OK/CANCEL. Sample Code:
/* This code displays a dialog box with a "Don't show me this dialog again" checkbox and an OK button. In normal circumstances, result will always be 0 on return. */ Please edit this page!Do you have...
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). |
|