VBcoders Guest



Don't have an account yet? Register
 


Forgot Password?



Display Message Box using MessageBoxIndirect API

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 Message Box using MessageBoxIndirect API

API Declarations


Private Const MB_OKCANCEL = 1
Private Const MB_ABORTRETRYIGNORE = 2
Private Const MB_YESNOCANCEL = 3
Private Const MB_YESNO = 4
Private Const MB_RETRYCANCEL = 5
Private Const OK = 1
Private Const CANCEL = 2
Private Const ABORT = 3
Private Const RETRY = 4
Private Const IGNORE = 5
Private Const YES = 6
Private Const NO = 7


Private Type MSGBOXPARAMS
cbSize As Long
hwndOwner As Long
hInstance As Long
lpszText As String
lpszCaption As String
dwStyle As Long
lpszIcon As String
dwContextHelpId As Long
lpfnMsgBoxCallback As Long
dwLanguageId As Long
End Type
Private Declare Function MessageBoxIndirect Lib "user32" Alias "MessageBoxIndirectA" (lpMsgBoxParams As MSGBOXPARAMS) As Long

Rate Display Message Box using MessageBoxIndirect API



Dim mymb As MSGBOXPARAMS
Dim rval As Long
mymb.cbSize = Len(mymb)
mymb.hwndOwner = Me.hWnd
mymb.hInstance = App.hInstance
mymb.lpszText = "Do you want to shutdown ?"
mymb.lpszCaption = "Warning!"
mymb.dwStyle = MB_OKCANCEL
rval = MessageBoxIndirect(mymb)
If (rval And OK) = OK Then MsgBox "OK Pressed"
If (rval And CANCEL) = CANCEL Then MsgBox "CANCEL Pressed"
If (rval And ABORT) = ABORT Then MsgBox "ABORT Pressed"
If (rval And RETRY) = RETRY Then MsgBox "RETRY Pressed"
If (rval And IGNORE) = IGNORE Then MsgBox "IGNORE Pressed"
If (rval And YES) = YES Then MsgBox "YES Pressed"
If (rval And NO) = NO Then MsgBox "NO Pressed"
End
End Sub
'Visit my Homepage at
'http://www.geocities.com/marskarthik
'http://marskarthik.virtualave.net
'Email: [email protected]

Download this snippet    Add to My Saved Code

Display Message Box using MessageBoxIndirect API Comments

No comments have been posted about Display Message Box using MessageBoxIndirect API. Why not be the first to post a comment about Display Message Box using MessageBoxIndirect API.

Post your comment

Subject:
Message:
0/1000 characters