1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44
| Option Explicit
'-----VISIBILITE DANS BARRE DES TACHES
'Private Declare Function FindWindowA& Lib "User32" (ByVal lpClassName$, ByVal lpWindowName$)
'Private Declare Function EnableWindow& Lib "User32" (ByVal hWnd&, ByVal bEnable&)
'Private Declare Function GetWindowLongA& Lib "User32" (ByVal hWnd&, ByVal nIndex&)
'Private Declare Function SetWindowLongA& Lib "User32" (ByVal hWnd&, ByVal nIndex&, ByVal dwNewLong&)
'-----BOUTON POUR REDUIRE USERFORM
Private Declare Function FindWindow Lib "User32" Alias "FindWindowA" (ByVal lpClassName As String, ByVal lpWindowName As String) As Long
Private Declare Function EnableWindow Lib "User32" (ByVal hWnd As Long, ByVal fEnable As Long) As Long
Private Declare Function ShowWindow Lib "User32" (ByVal hWnd As Long, ByVal nCmdShow 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 GetWindowLong Lib "User32" Alias "GetWindowLongA" (ByVal hWnd As Long, ByVal nIndex As Long) As Long
Private Sub UserForm_Initialize()
Dim hWnd As Long
'-----BOUTON POUR REDUIRE USERFORM
hWnd = FindWindow(vbNullString, Me.Caption) 'Définir la fenêtre sur laquelle agir
SetWindowLong hWnd, -16, GetWindowLong(hWnd, -16) Or &H20000 'To set a new window style by replacing it by retrieving the old window styles or to put a minimize button on the userform!
End Sub
Private Sub UserForm_Activate()
Dim hWnd As Long
'-----VISIBILITE DANS BARRE DES TACHES
hWnd = FindWindow(vbNullString, Me.Caption) 'Définir la fenêtre sur laquelle agir
ShowWindow hWnd, 0 'How to show the window (Hides the window and activates another window)
SetWindowLong hWnd, -20, GetWindowLong(hWnd, -20) Or &H40000 'Change an attribute of the specified window (here -20 = sets a new extended window style...remplacé par la valeur issue de Getwindowlong (-20 = retrieves the extended window styles) OR (Forces a top-level window onto the taskbar when the window is visible)
ShowWindow hWnd, 5 'How to show the window (Activates the window and displays it in its current size and position.)
'EnableWindow FindWindow(vbNullString, Application.Caption), True 'Enable or dsable user interaction with the window (click, keyboard...)
'Me.Repaint 'On redessine le Userform
'-----BOUTON POUR REDUIRE USERFORM
'hWnd = FindWindow("XLMAIN", Application.Caption)
'EnableWindow hWnd, 1
End Sub
Private Sub CommandButton1_Click()
Call Close_UF
End Sub |
Partager