获得屏幕分辩率的函数
已有 917 次阅读2008-1-27 15:08
Option Compare Database
Private Declare Function GetDC Lib "user32" (ByVal hwnd As Long) As Long
Private Declare Function GetDeviceCaps Lib "gdi32" (ByVal hdc As Long, ByVal nIndex As Long) As Long
Public Function getscreenw() As Long
'获得屏幕分辩率的长
hdc = GetDC(0)
getscreenw = GetDeviceCaps(hdc, 8)
End Function
Public Function getscreenh() As Long
'获得屏幕分辩率的高
hdc = GetDC(0)
getscreenh = GetDeviceCaps(hdc, 10)
End Function
'获得屏幕分辩率的长的TIPS
Public Function getscreenwT() As Long
hdc = GetDC(0)
getscreenwT = GetDeviceCaps(hdc, 8) * 15
End Function
'获得屏幕分辩率的高的TIPS
Public Function getscreenhT() As Long
hdc = GetDC(0)
getscreenhT = GetDeviceCaps(hdc, 10) * 15
End Function