Private Declare Function FindWindow Lib "user32" Alias "FindWindowA" (ByVal lpClassName As String, ByVal lpWindowName As String) 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 Const GWL_STYLE As Long = (-16) 'The offset of a window's style Public hwnd As Long Public Sub toto(F As Object) hwnd = FindWindow(vbNullString, F.Caption) iStyle = GetWindowLong(hwnd, GWL_STYLE) Or &H70000 SetWindowLong hwnd, GWL_STYLE, iStyle End Sub
Private Sub UserForm_Initialize() toto Me End Sub Private Sub UserForm_Resize() 'If IsIconic(hwnd) Then Application.WindowState xlMinimized Else Application.WindowState xlNormal DoEvents If IsIconic(hwnd) Then Application.Visible False Else Application.Visible True End Sub
Private Sub UserForm_Resize() Application.Visible = Not CBool(IsIconic(hwnd)) End Sub
Vous n’avez pas trouvé la réponse que vous recherchez ?
Posez votre questionPrivate hwnd Private Declare Function IsIconic& Lib "user32" (ByVal hwnd&)
Private Sub UserForm_Resize() 'Dim WdState 'Set WdState Application.WindowState xlNormal If IsIconic(hwnd) <> 0 Then Application.WindowState = xlMinimized 'Application.Visible = False 'Else 'Application.Visible = True 'Application.WindowState = WdState End If End Sub
If IsIconic(hwnd) Then
Private Sub UserForm_Resize()
msgbox hwnd <<<<<<<<<<<<<<<<<<<<<<<<<<<========= ICI
'Dim WdState
'Set WdState Application.WindowState xlNormal
If IsIconic(hwnd) <> 0 Then
Application.WindowState = xlMinimized
'Application.Visible = False
'Else
'Application.Visible = True
'Application.WindowState = WdState
End If
End Sub
Private Declare Function FindWindow Lib "User32" Alias "FindWindowA" (ByVal lpClassName As String, ByVal lpWindowName As String) 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 Const GWL_STYLE As Long = (-16) 'The offset of a window's style Public hwnd As Long 'à la place de Private hwnd As Long ? Private IStyle As Long Public Sub toto(F As Object) hWnd = FindWindow(vbNullString, F.Caption) iStyle = GetWindowLong(hWnd, GWL_STYLE) Or &H70000 SetWindowLong hWnd, GWL_STYLE, iStyle End Sub
Private hwnd Private Declare Function IsIconic& Lib "user32" (ByVal hwnd&) Private Sub UserForm_Initialize() toto Me End Sub Private Sub UserForm_Resize() 'Dim WdState 'Set WdState Application.WindowState xlNormal If IsIconic(hwnd) <> 0 Then Application.WindowState = xlMinimized 'Application.Visible = False 'Else 'Application.Visible = True 'Application.WindowState = WdState End If End Sub