Bonjour le forum,
Le code ci-dessous masque la barre de titre du userform (y compris les croix ).
Il faut impérativement penser à prévoir un bouton pour sortir du UsrFrm (Unload Me )
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 Sub UserForm_Initialize()
Dim hWnd As Long, Style As Long
hWnd = FindWindow(vbNullString, Me.Caption)
Style = GetWindowLong(hWnd, -16) And Not &HC00000
SetWindowLong hWnd, -16, Style
DrawMenuBar hWnd
End Sub
Cdlt.
Message édité par: Ashaar, à: 02/05/2005 12:22
Bon, finalement il y a mieux : on conserve la barre de titre.
Private Declare Function GetWindowLongA Lib 'User32' _
(ByVal hWnd As Long, ByVal nIndex As Long) As Long
Private Declare Function SetWindowLongA Lib 'User32' _
(ByVal hWnd As Long, ByVal nIndex As Long, _
ByVal dwNewLong As Long) As Long
Private Declare Function FindWindowA Lib 'User32' _
(ByVal lpClassName As String, ByVal lpWindowName As String) As Long
Private Sub UserForm_Initialize()
Dim hWnd As Long
hWnd = FindWindowA('Thunder' & IIf(Application.Version Like '8*', _
'X', 'D') & 'Frame', Me.Caption)
SetWindowLongA hWnd, -16, GetWindowLongA(hWnd, -16) And &HFFF7FFFF
End Sub
Message édité par: Ashaar, à: 02/05/2005 12:41