Private Declare Function FindWindow Lib "user32" Alias "FindWindowA" _ (ByVal lpClassName As String, ByVal lpWindowName As String) As Long Private Declare Function GetWindowLong Lib "user32" Alias _ "GetWindowLongA" (ByVal hwnd As Long, ByVal nIndex As Long) As Long Private Declare Function SetWindowLong Lib "user32" Alias "SetWindowLongA" _ (ByVal hwnd As Long, ByVal nIndex As Long, ByVal dwNewLong As Long) As Long Private Declare Function DrawMenuBar Lib "user32" (ByVal hwnd As Long) As Long Private Declare Function ShowWindow Lib "user32" (ByVal hwnd As Long, ByVal nCmdShow As Long) As Long Private Sub UserForm_Initialize() Dim hwnd As Long, Style As Long hwnd = FindWindow(vbNullString, Me.Caption) ShowWindow hwnd, 3 Style = GetWindowLong(hwnd, -16) And &H10000 And Not &HC00000 SetWindowLong hwnd, -16, Style DrawMenuBar hwnd End Sub
un dernier petit détail
Private Declare Function GetSystemMetrics32 Lib "User32" Alias "GetSystemMetrics" (ByVal nIndex As Long) As Long Dim w As Long Dim h As Long Sub DisplayMonitorInfo() w = GetSystemMetrics32(0) ' width in points h = GetSystemMetrics32(1) ' height in points End Sub Private Sub UserForm_Initialize() DisplayMonitorInfo 'c'est peut etre trop grand usf.Width = w usf.Height = h End Sub
Vous n’avez pas trouvé la réponse que vous recherchez ?
Posez votre questionHum, ne connaissant pas les conséquences liées à ce code tu pourrais me les dire avant de voir si je le fait ou pas (si cela ne te dérange pas bien sur^^) :)