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 27 28
| Option Explicit
Private Declare Function GetDC Lib "user32" (ByVal hwnd As Long) As Long
Private Declare Function ReleaseDC Lib "user32" (ByVal hwnd As Long, _
ByVal hdc As Long) As Long
Private Declare Function GetDeviceCaps Lib "gdi32" (ByVal hdc As Long, _
ByVal nIndex As Long) As Long
Const couic As Long = 1440
Private Sub Command1_Click()
MsgBox "ton écran estr configuré ainsi : " & vbCrLf & _
nbtwipsparpixhor & " twips par pixel horizontalement " & vbCrLf & _
nbtwipsparpixver & " twips par pixel verticalement "
End Sub
Function nbtwipsparpixhor() As Single
Dim coucou As Long
coucou = GetDC(0)
nbtwipsparpixhor = couic / GetDeviceCaps(coucou, 88)
ReleaseDC 0, coucou
End Function
Function nbtwipsparpixver() As Single
Dim coucou As Long
coucou = GetDC(0)
nbtwipsparpixver = couic / GetDeviceCaps(coucou, 90)
ReleaseDC 0, coucou
End Function |
Partager