Option Explicit
Private Declare Function SetTimer Lib "user32" _
(ByVal hwnd As Long, ByVal nIDEvent As Long, ByVal uElapse As Long, _
ByVal lpTimerFunc As Long) As Long
Private Declare Function KillTimer Lib "user32" (ByVal hwnd As Long, _
ByVal nIDEvent As Long) As Long
Private Declare Function FindWindow Lib "user32" Alias "FindWindowA" _
(ByVal lpClassName As String, ByVal lpWindowName As String) As Long
Private Declare Function FindWindowEx Lib "user32" Alias "FindWindowExA" _
(ByVal hwndParent As Long, ByVal hwndChildAfter As Long, _
ByVal lpszClass As String, ByVal lpszWindow As String) As Long
Declare Function SetWindowText Lib "user32" Alias "SetWindowTextA" _
(ByVal hwnd As Long, ByVal lpString As String) As Long
Private Const NV_MSGBOX As Long = &H5000&
Private sBut(2) As String, sTit As String
Public Function CustMsgBox(ByVal F As Form, ByVal sText As String, ByVal sTitle As String, _
ByVal Picture As VbMsgBoxStyle, _
ByVal sButton1 As String, _
Optional ByVal sButton2 As String, _
Optional ByVal sButton3 As String) As Long
Dim N As Long, lBut As Long, lRet As Long
sTit = sTitle
sBut(0) = sButton1: sBut(1) = sButton2: sBut(2) = sButton3
SetTimer F.hwnd, NV_MSGBOX, 10, AddressOf ChangeButtons
For N = 0 To 2
If Len(sBut(N)) Then lBut = lBut + 1
Next N
lRet = MsgBox(sText, Picture Or (lBut - 1), sTitle)
If lRet > 2 Then lRet = lRet - 2
CustMsgBox = lRet
End Function
Private Sub ChangeButtons(ByVal plngHandle As Long, ByVal uMsg As Long, _
ByVal plngEventId As Long, ByVal dwTime As Long)
Dim lhWnd As Long, lhBut As Long, lhTemp As Long, N As Long
lhWnd = FindWindow("#32770", sTit)
For N = 0 To 2
If Len(sBut(N)) Then
Do
lhTemp = FindWindowEx(lhWnd, lhBut, "Button", vbNullString)
Loop While lhTemp = lhBut
lhBut = lhTemp
SetWindowText lhBut, sBut(N)
End If
Next N
KillTimer plngHandle, plngEventId
End Sub