Private Const SW_MINIMIZE = 6 Private Type POINTAPI x As Long y As Long End Type Private Type RECT Left As Long Top As Long Right As Long Bottom As Long End Type Private Type WINDOWPLACEMENT Length As Long flags As Long showCmd As Long ptMinPosition As POINTAPI ptMaxPosition As POINTAPI rcNormalPosition As RECT End Type Private Declare Function ClientToScreen Lib "user32" (ByVal hwnd As Long, lpPoint As POINTAPI) As Long Private Declare Function GetWindowPlacement Lib "user32" (ByVal hwnd As Long, lpwndpl As WINDOWPLACEMENT) As Long Private Declare Function SetWindowPlacement Lib "user32" (ByVal hwnd As Long, lpwndpl As WINDOWPLACEMENT) As Long 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 Dim Rectan As RECT, totohwnd As Long Private Sub userForm_initialize() Dim mWnd As Long, Style As Long mWnd = FindWindow(vbNullString, Me.Caption) Style = GetWindowLong(mWnd, -16) And Not &HC00000 And Not &H40000 SetWindowLong mWnd, -16, Style DrawMenuBar mWnd Dim WinEst As WINDOWPLACEMENT Dim rtn As Long WinEst.Length = Len(WinEst) totohwnd = FindWindow(vbNullString, Me.Caption) rtn = GetWindowPlacement(totohwnd, WinEst) Rectan = WinEst.rcNormalPosition End Sub Private Sub CommandButton1_Click() Dim WinEst As WINDOWPLACEMENT Dim Punto As POINTAPI Dim rtn As Long Punto.x = 1000 Punto.y = 0 WinEst.Length = Len(WinEst) WinEst.showCmd = SW_MINIMIZE WinEst.ptMinPosition = Punto WinEst.ptMaxPosition = Punto WinEst.rcNormalPosition = Rectan rtn = SetWindowPlacement(totohwnd, WinEst) End Sub
Vous n’avez pas trouvé la réponse que vous recherchez ?
Posez votre question