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
| Option Explicit
Declare Function GetDC& Lib "user32.dll" (ByVal hwnd&)
Declare Function GetDeviceCaps& Lib "gdi32" (ByVal hDC&, ByVal nIndex&)
' Fonction d'acquisition de l'identifiant de la fenêtre active
Private Declare Function GAW Lib "User32" Alias "GetActiveWindow" () As Long
' Fonction de changement
Private Declare Function SWL Lib "User32" Alias "SetWindowLongA" (ByVal hwnd As Long, ByVal nIndex As Long, ByVal dwNewLong As Long) As Long
'Fonction pour redresser l'affichage de la form sans la caption
Private Declare Function DrawMenuBar Lib "User32" (ByVal hwnd As Long) As Long
Sub Sans_Caption()
SWL GAW, -16, &H94080080: SWL GAW, -20, 0: DrawMenuBar GAW
End Sub
Sub position_usf(usf, cel)
' 1 inch = 72 points for usually 96 or 120 dpi
Dim x#, y#, w#, h#
x = GetDeviceCaps(GetDC(0), 88) / 72
y = GetDeviceCaps(GetDC(0), 90) / 72
With usf
.StartUpPosition = 0
.Left = (ActiveWindow.PointsToScreenPixelsX(cel.Left * x) * 1 / x)
.Top = (ActiveWindow.PointsToScreenPixelsY(cel.Top * y) * 1 / y)
End With
ActiveWindow.ScrollRow = cel.Row
ActiveWindow.ScrollColumn = cel.Column
End Sub |
Partager