by Karthikeyan (187 Submissions)
Category: Windows API Call/Explanation
Compatability: Visual Basic 5.0
Difficulty: Unknown Difficulty
Originally Published: Tue 2nd October 2001
Date Added: Mon 8th February 2021
Rating: (1 Votes)
Display a message box using MessageBox API
API Declarations
Private Const MB_OKCANCEL = &H1&
Private Const MB_OK = &H0&
Private Const MB_ABORTRETRYIGNORE = &H2&
Private Const MB_YESNOCANCEL = &H3&
Private Const MB_YESNO = &H4&
Private Declare Function MessageBox Lib "user32" Alias "MessageBoxA" (ByVal hwnd As Long, ByVal lpText As String, ByVal lpCaption As String, ByVal wType As Long) As Long
Dim rval As Long
rval = MessageBox(Me.hwnd, "Hello.How r u?", "Test Message", MB_ABORTRETRYIGNORE)
Select Case rval
Case 1
MsgBox "Ok button Pressed"
Case 2
MsgBox "Cancel button Pressed"
Case 3
MsgBox "Abort button Pressed"
Case 4
MsgBox "Retry button Pressed"
Case 5
MsgBox "Ignore button Pressed"
Case 6
MsgBox "Yes button Pressed"
Case 7
MsgBox "No button Pressed"
End Select
End
End Sub
'Visit my Homepage at
'http://www.geocities.com/marskarthik
'http://marskarthik.virtualave.net
'Email: [email protected]