Bonjour à tous,
une proposition (non complète ca il reste la barre de titre en haut...)
Pour cette barre ...
Après tests, j'ai modifié " SetWindowPos...." en enlevant "-25" et "+25" à l'instruction ".Top", sinon on perdrait 2 lignes en haut.
Option Explicit
'### Apis ###
Declare Function SetWindowLong& Lib "user32" Alias "SetWindowLongA" ( _
ByVal Hwnd As Long, ByVal nIndex As Long, ByVal dwNewLong As Long)
Private Declare Function GetWindowLong& Lib "user32" Alias "GetWindowLongA" ( _
ByVal Hwnd As Long, ByVal nIndex As Long)
Declare Function SetWindowPos& Lib "user32" ( _
ByVal Hwnd As Long, ByVal hWndInsertAfter As Long, ByVal x As Long, _
ByVal y As Long, ByVal cx As Long, ByVal cy As Long, ByVal wFlags As Long)
Declare Function GetWindowRect& Lib "user32" (ByVal Hwnd As Long, lpRect As structRECT)
'### Constantes ###
'--- GetWindowLong ---
Const GWL_STYLE = (-16)
Const WS_CAPTION = &HC00000
Const WS_MAXIMIZEBOX = &H10000
Const WS_MINIMIZEBOX = &H20000
Const WS_SYSMENU = &H80000
'--- SetWindowPos ---
Const SWP_FRAMECHANGED = &H20
Const SWP_DRAWFRAME = SWP_FRAMECHANGED
Const SWP_HIDEWINDOW = &H80
Const SWP_NOACTIVATE = &H10
Const SWP_NOCOPYBITS = &H100
Const SWP_NOMOVE = &H2
Const SWP_NOOWNERZORDER = &H200
Const SWP_NOREDRAW = &H8
Const SWP_NOREPOSITION = SWP_NOOWNERZORDER
Const SWP_NOSIZE = &H1
Const SWP_NOZORDER = &H4
Const SWP_SHOWWINDOW = &H40
'--- GetWindowRect ---
Private Type structRECT
Left As Long
Top As Long
Right As Long
Bottom As Long
End Type
Sub DemasqueTitreAppli()
Call SwitchMasque(True)
End Sub
Sub MasqueTitreAppli()
Call SwitchMasque(False)
End Sub
Sub SwitchMasque(bool As Boolean)
Dim Style&
Dim Rect As structRECT
Dim Hwnd&
Hwnd& = Application.Hwnd
GetWindowRect Hwnd&, Rect
'---
Style& = GetWindowLong(Hwnd&, GWL_STYLE)
If Not bool Then
Style& = Style& And Not WS_SYSMENU
Style& = Style& And Not WS_MAXIMIZEBOX
Style& = Style& And Not WS_MINIMIZEBOX
Style& = Style& And Not WS_CAPTION
Else
Style& = Style& Or WS_SYSMENU
Style& = Style& Or WS_MAXIMIZEBOX
Style& = Style& Or WS_MINIMIZEBOX
Style& = Style& Or WS_CAPTION
End If
SetWindowLong Hwnd&, GWL_STYLE, Style&
'---
With Rect
''' SetWindowPos Hwnd&, 0, .Left, .Top - 25, .Right - .Left, .Bottom - .Top + 25, _
SWP_NOREPOSITION Or SWP_NOZORDER Or SWP_FRAMECHANGED
SetWindowPos Hwnd&, 0, .Left, .Top , .Right - .Left, .Bottom - .Top , _
SWP_NOREPOSITION Or SWP_NOZORDER Or SWP_FRAMECHANGED
End With
End Sub
ric