In module:
VB Code:
  1. Option Explicit
  2.  
  3. Private Declare Function SetTimer Lib "user32" _
  4.     (ByVal hwnd As Long, ByVal nIDEvent As Long, ByVal uElapse As Long, _
  5.     ByVal lpTimerFunc As Long) As Long
  6.  
  7. Private Declare Function KillTimer Lib "user32" (ByVal hwnd As Long, _
  8.     ByVal nIDEvent As Long) As Long
  9.  
  10. Private Declare Function FindWindow Lib "user32" Alias "FindWindowA" _
  11.     (ByVal lpClassName As String, ByVal lpWindowName As String) As Long
  12.  
  13. Private Declare Function FindWindowEx Lib "user32" Alias "FindWindowExA" _
  14.     (ByVal hwndParent As Long, ByVal hwndChildAfter As Long, _
  15.     ByVal lpszClass As String, ByVal lpszWindow As String) As Long
  16. Declare Function SetWindowText Lib "user32" Alias "SetWindowTextA" _
  17.     (ByVal hwnd As Long, ByVal lpString As String) As Long
  18.  
  19. Private Const NV_MSGBOX As Long = &H5000&
  20. Private sBut(2) As String, sTit As String
  21.  
  22. Public Function CustMsgBox(ByVal F As Form, ByVal sText As String, ByVal sTitle As String, _
  23.                            ByVal Picture As VbMsgBoxStyle, _
  24.                            ByVal sButton1 As String, _
  25.                            Optional ByVal sButton2 As String, _
  26.                            Optional ByVal sButton3 As String) As Long
  27.     Dim N As Long, lBut As Long, lRet As Long
  28.     sTit = sTitle
  29.     sBut(0) = sButton1: sBut(1) = sButton2: sBut(2) = sButton3
  30.     SetTimer F.hwnd, NV_MSGBOX, 10, AddressOf ChangeButtons
  31.     For N = 0 To 2
  32.         If Len(sBut(N)) Then lBut = lBut + 1
  33.     Next N
  34.     lRet = MsgBox(sText, Picture Or (lBut - 1), sTitle)
  35.     If lRet > 2 Then lRet = lRet - 2
  36.     CustMsgBox = lRet
  37. End Function
  38.  
  39. Private Sub ChangeButtons(ByVal plngHandle As Long, ByVal uMsg As Long, _
  40.                           ByVal plngEventId As Long, ByVal dwTime As Long)
  41.     Dim lhWnd As Long, lhBut As Long, lhTemp As Long, N As Long
  42.    
  43.     lhWnd = FindWindow("#32770", sTit)
  44.     For N = 0 To 2
  45.         If Len(sBut(N)) Then
  46.             Do
  47.                 lhTemp = FindWindowEx(lhWnd, lhBut, "Button", vbNullString)
  48.             Loop While lhTemp = lhBut
  49.             lhBut = lhTemp
  50.             SetWindowText lhBut, sBut(N)
  51.         End If
  52.     Next N
  53.     KillTimer plngHandle, plngEventId
  54. End Sub
You then call it like this:
VB Code:
  1. Private Sub Command1_Click()
  2.     Dim lRet As Long
  3.     lRet = CustMsgBox(Me, "Click a button", "MsgBox Title", vbExclamation, "button1", "button2", "button3")
  4.     ' lRet is the number of the button pressed, either button 1, 2 or 3
  5. End Sub