1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19
|
Private Declare Function RemoveMenu Lib "user32" (ByVal hMenu As Long, ByVal nPosition As Long, _
ByVal wFlags As Long) As Long
Private Declare Function GetSystemMenu Lib "user32" (ByVal hwnd As Long, ByVal bRevert As Long) As Long
Private Declare Function FindWindow Lib "user32.dll" Alias "FindWindowA" (ByVal lpClassName As String, _
ByVal lpWindowName As String) As Long
Private Const MF_BYPOSITION = &H400&
Les déclarations sur l'API windows
et son utilisation:
Private Sub UserForm_Initialize()
Dim lHwnd As Long
lHwnd = FindWindow("ThunderDFrame", Me.Caption) 'Change to match your userforms caption
Do While lHwnd = 0
lHwnd = FindWindow("ThunderDFrame", Me.Caption) 'Change to match your userforms caption
DoEvents
Loop
RemoveMenu GetSystemMenu(lHwnd, 0), 6, MF_BYPOSITION 'When using by position, 6 represents the 7th menu item (including separators)
End Sub |