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.
MessageBox (user32)
.
C# Signature:
[DllImport("user32.dll", CharSet=CharSet.Auto)]
public static extern MessageBoxResult MessageBox(IntPtr hWnd, String text, String caption, int options);
uint range:0~6
VB.NET Signature:
<DllImport("user32.dll", EntryPoint:="MessageBoxW", SetLastError:=True, Charset:=Charset.Unicode)> _
Public Function MessageBox(hwnd As IntPtr, _
<MarshalAs(UnmanagedType.LPTSTR)> lpText As String, _
<MarshalAs(UnmanagedType.LPTSTR)>lpCaption As String, _
<MarshalAs(UnmanagedType.U4)>uType As MessageBoxOptions) As <MarshalAs(UnmanagedType.U4)>MessageBoxResult
End Function
VB Signature:
Public Declare Function MessageBox Lib "user32.dll" Alias "MessageBoxA" _
(ByVal prmlngWindowHandle As Long, _
ByVal prmstrMessage As String, _
ByVal prmstrCaption As String, _
ByVal prmlngType As MessageBoxOptions) As MessageBoxResult
Class Class1
<DllImport("user32.dll", EntryPoint:="MessageBoxW", SetLastError:=True, Charset:=Charset.Unicode)> _
Public Function MessageBox(hwnd As IntPtr, _
<MarshalAs(UnmanagedType.LPTSTR)> lpText As String, _
<MarshalAs(UnmanagedType.LPTSTR)>lpCaption As String, _
<MarshalAs(UnmanagedType.U4)>uType As MessageBoxOptions) As <MarshalAs(UnmanagedType.U4)>MessageBoxResult
End Function
<STAThread> _
Public Sub Main()
MessageBox(IntPtr.Zero, "Text", "Caption", MessageBoxOptions.Ok or MessageBoxOptions.IconWarning)
End Sub
End Class
Sample Code VB:
Public Declare Function MessageBox Lib "user32.dll" Alias "MessageBoxA" _
(ByVal prmlngWindowHandle As Long, _
ByVal prmstrMessage As String, _
ByVal prmstrCaption As String, _
ByVal prmlngType As MessageBoxOptions) As MessageBoxResult
MessageBox(0, "Text", "Caption", MessageBoxOptions.Ok or MessageBoxOptions.IconWarning)
6/11/2012 7:51:01 AM - johnbell149@gmail.com-202.74.138.1
MessageBoxResult - Return value of a message box
4/3/2016 5:29:48 PM - -186.228.1.130
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).