● 解像度を取得する ●

Private Declare Function GetDeviceCaps Lib "gdi32" (ByVal hdc As Long, ByVal nIndex As Long) As Long

Private Const HORZRES = 8
Private Const VERTRES = 10

Private Sub Command1_Click()

    Dim xPixles&, yPixles As Long

    xPixles = GetDeviceCaps(Me.hdc, HORZRES)
    yPixles = GetDeviceCaps(Me.hdc, VERTRES)

    Call MsgBox("モニターの解像度は" & xPixles & "×" & yPixles & "です。")

End Sub

戻る