毕业论文开发语言企业开发JAVA技术.NET技术WEB开发Linux/Unix数据库技术Windows平台移动平台嵌入式论文范文英语论文
您现在的位置: 毕业论文 >> 开发语言 >> 正文

vb如何获取双屏分辨率

更新时间:2013-4-15:  来源:毕业论文

vb如何获取双屏分辨率
本人vb菜鸟  现在要求获取一机双屏中的双屏分辨率 

主屏的已经找到
ResWidth = Screen.Width Screen.TwipsPerPixelX
 
ResHeight = Screen.Height Screen.TwipsPerPixelY
Visual Basic code? 'In a form (Form1) Private Sub Form_Load()     'KPD-Team 2000     'URL:    'E-Mail: KPDTeam@allapi.net     'set the graphics mode of this form to persistent     Me.AutoRedraw = True    'start the enumeration     EnumDisplayMonitors ByVal 0&, ByVal 0&, AddressOf MonitorEnumProc, ByVal 0& End Sub 毕业论文 


Visual Basic code?'In a module Public Const MONITORINFOF_PRIMARY = &H1 Public Const MONITOR_DEFAULTTONEAREST = &H2 Public Const MONITOR_DEFAULTTONULL = &H0 Public Const MONITOR_DEFAULTTOPRIMARY = &H1 Public Type RECT     Left As Long    Top As Long    Right As Long    Bottom As LongEnd Type Public Type MONITORINFO     cbSize As Long    rcMonitor As RECT     rcWork As RECT     dwFlags As LongEnd Type Public Type POINT     x As Long    y As LongEnd Type Public Declare Function GetMonitorInfo Lib "user32.dll" Alias "GetMonitorInfoA" (ByVal hMonitor As Long, ByRef lpmi As MONITORINFO) As LongPublic Declare Function MonitorFromPoint Lib "user32.dll" (ByVal x As Long, ByVal y As Long, ByVal dwFlags As Long) As LongPublic Declare Function MonitorFromRect Lib "user32.dll" (ByRef lprc As RECT, ByVal dwFlags As Long) As LongPublic Declare Function MonitorFromWindow Lib "user32.dll" (ByVal hwnd As Long, ByVal dwFlags As Long) As LongPublic Declare Function EnumDisplayMonitors Lib "user32.dll" (ByVal hdc As Long, ByRef lprcClip As Any, ByVal lpfnEnum As Long, ByVal dwData As Long) As LongPublic Declare Function GetWindowRect Lib "user32" (ByVal hwnd As Long, lpRect As RECT) As LongPublic Function MonitorEnumProc(ByVal hMonitor As Long, ByVal hdcMonitor As Long, lprcMonitor As RECT, ByVal dwData As Long) As Long    Dim MI As MONITORINFO, R As RECT     Debug.Print "Moitor handle: " + CStr(hMonitor)     'initialize the MONITORINFO structure     MI.cbSize = Len(MI)     'Get the monitor information of the specified monitor     GetMonitorInfo hMonitor, MI     'write some information on teh debug window     Debug.Print "Monitor Width/Height: " + CStr(MI.rcMonitor.Right - MI.rcMonitor.Left) + "x" + CStr(MI.rcMonitor.Bottom - MI.rcMonitor.Top)     Debug.Print "Primary monitor: " + CStr(CBool(MI.dwFlags = MONITORINFOF_PRIMARY))     'check whether Form1 is located on this monitor     If MonitorFromWindow(Form1.hwnd, MONITOR_DEFAULTTONEAREST) = hMonitor Then        Debug.Print "Form1 is located on this monitor"    End If    'heck whether the point (0, 0) lies within the bounds of this monitor     If MonitorFromPoint(0, 0, MONITOR_DEFAULTTONEAREST) = hMonitor Then        Debug.Print "The point (0, 0) lies wihthin the range of this monitor..."    End If    'check whether Form1 is located on this monitor     GetWindowRect Form1.hwnd, R     If MonitorFromRect(R, MONITOR_DEFAULTTONEAREST) = hMonitor Then        Debug.Print "The rectangle of Form1 lies within this monitor"    End If    Debug.Print ""    'Continue enumeration     MonitorEnumProc = 1 End Function

Google: API-Guide
该软件包含收集了许多常用 API 例子。

设为首页 | 联系站长 | 友情链接 | 网站地图 |

copyright©youerw.com 优尔论文网 严禁转载
如果本毕业论文网损害了您的利益或者侵犯了您的权利,请及时联系,我们一定会及时改正。