Display Message Box using MessageBoxIndirect API
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
(1(1 Vote))
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]
Display Message Box using MessageBoxIndirect API Comments
No comments yet — be the first to post one!
Post a Comment