Problème résolu, voici le message avec la MsgBox standard sur la gauche et avec ma MsgBox sur la droite, l'objectif est d'utiliser des boutons personnalisés.
Et le code utilisé
Option Explicit
Private Declare Function GetDeviceCaps Lib "gdi32" (ByVal hdc As Long, ByVal nIndex As Long) As Long
Private Const LOGPIXELSY = 90
Private Declare Function SystemParametersInfo Lib "user32" Alias "SystemParametersInfoA" (ByVal uAction As Long, ByVal uParam As Long, ByRef lpvParam As Any, ByVal fuWinIni As Long) As Long
Private Const SPI_GETNONCLIENTMETRICS = 41
Private Const LF_FACESIZE = 32
Private Type LOGFONT
lfHeight As Long
lfWidth As Long
lfEscapement As Long
lfOrientation As Long
lfWeight As Long
lfItalic As Byte
lfUnderline As Byte
lfStrikeOut As Byte
lfCharSet As Byte
lfOutPrecision As Byte
lfClipPrecision As Byte
lfQuality As Byte
lfPitchAndFamily As Byte
lfFaceName(1 To LF_FACESIZE) As Byte
End Type
Private Type NONCLIENTMETRICS
cbSize As Long
iBorderWidth As Long
iScrollWidth As Long
iScrollHeight As Long
iCaptionWidth As Long
iCaptionHeight As Long
lfCaptionFont As LOGFONT
iSMCaptionWidth As Long
iSMCaptionHeight As Long
lfSMCaptionFont As LOGFONT
iMenuWidth As Long
iMenuHeight As Long
lfMenuFont As LOGFONT
lfStatusFont As LOGFONT
lfMessageFont As LOGFONT
End Type
Private Sub Form_Load()
Dim retVal As Long
Dim NCM As NONCLIENTMETRICS
Dim strFontName As String
NCM.cbSize = Len(NCM)
retVal = SystemParametersInfo(SPI_GETNONCLIENTMETRICS, 0, NCM, 0)
strFontName = StrConv(NCM.lfMessageFont.lfFaceName, vbUnicode)
Msg.Font.Name = Left(strFontName, InStr(strFontName, Chr(0)) - 1)
Msg.Font.Size = -((NCM.lfMessageFont.lfHeight * 72) / GetDeviceCaps(hdc, LOGPIXELSY))
End Sub
Commentaires bienvenus.