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
| Private Declare Function GetSystemMetrics& _
Lib "user32" (ByVal nIndex&)
Private Declare Function GetForegroundWindow& _
Lib "user32" ()
Private Declare Function GetWindowRect& _
Lib "user32" (ByVal hwnd&, lpRect As RECT)
Private Type RECT
Left As Long
Top As Long
Right As Long
Bottom As Long
End Type
Sub Resolution()
Dim Info As String, hwnd As Long, R As RECT
Info = "Résolution écran:" & vbTab _
& GetSystemMetrics(0) & " x " _
& GetSystemMetrics(1) & vbLf
hwnd = GetForegroundWindow
GetWindowRect hwnd, R
Info = Info & "Fenêtre active:" & vbTab _
& (R.Right - R.Left) & " x " & R.Bottom - R.Top
Info = Info & vbLf & "Fenêtre Excel:" & vbTab _
& Application.Width * 4 / 3 & " x " & Application.Height * 4 / 3
MsgBox Info
End Sub |