> For the complete documentation index, see [llms.txt](https://pinvokeisalive.gitbook.io/pinvoke/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://pinvokeisalive.gitbook.io/pinvoke/desktopfunctions/shlwapi/shmessageboxcheck.md).

# SHMessageBoxCheck

### C# Signature:

```cs
/* 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. */

[DllImport("shlwapi.dll", EntryPoint="#185", ExactSpelling=true, PreserveSig=false)]
public static extern int SHMessageBoxCheck(
    [In] IntPtr hwnd,
    [In] String pszText,
    [In] String pszTitle,
    [In] MessageBoxCheckFlags uType,
    [In] int iDefault,
    [In] string pszRegVal
    );
```

### VB Signature:

```cs
Declare Function SHMessageBoxCheck Lib "shlwapi.dll" (TODO) As TODO
```

### Notes:

```cs
/* We use the Windows Shell function SHMessageBoxCheck, so we have to define this parallel enum of the definitions in winuser.h. */

public enum MessageBoxCheckFlags : uint
{
    MB_OK             = 0x00000000,
    MB_OKCANCEL           = 0x00000001,
    MB_YESNO          = 0x00000004,
    MB_ICONHAND           = 0x00000010,
    MB_ICONQUESTION       = 0x00000020,
    MB_ICONEXCLAMATION    = 0x00000030,
    MB_ICONINFORMATION    = 0x00000040
}
```

### Notes:

```cs
HKEY_CURRENT_USER
        Software
            Microsoft
                Windows
                    CurrentVersion
                        Explorer
                            DontShowMeThisDialogAgain
```

### Sample Code:

```cs
/* 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. */

int result;

try 
{
    result = SHMessageBoxCheck(
        this.Handle,
        "This text fills the dialog",
        "This text is in the title bar",
        MessageBoxCheckFlags.MB_OK | MessageBoxCheckFlags.MB_ICONINFORMATION,
        0,
        "MyApplicationName.exe" // This last argument is the value of the registry key
        );
}
catch( Exception e ) 
{
// Note that the only exceptions we can get here are inter-op exceptions, I think.
    result = -1;
}

if( result == -1 ) 
{
// The dialog didn't show up, so do some alternate action here.
}
```


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://pinvokeisalive.gitbook.io/pinvoke/desktopfunctions/shlwapi/shmessageboxcheck.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
