Dim disp As String, dl As Integer, sw As Single, sh As Single
sw = Screen.Width: sh = Screen.Height
disp = sw \ Screen.TwipsPerPixelX & " x " & sh \ Screen.TwipsPerPixelY

解决方案 »

  1.   

    VB声明】
      Private Declare Function GetWindowRect Lib "user32" Alias "GetWindowRect" (ByVal hwnd As Long, lpRect As RECT) As Long【说明】
      获得整个窗口的范围矩形,窗口的边框、标题栏、滚动条及菜单等都在这个矩形内 【返回值】
      Long,非零表示成功,零表示失败。会设置GetLastError 【备注】
      如将它与通过GetDesktopWindow获得的句柄联合使用,可获得对整个可视显示区域(桌面)进行说明的矩形【参数表】
      hwnd -----------  Long,想获得范围矩形的那个窗口的句柄  lpRect ---------  RECT,屏幕坐标中随同窗口装载的矩形
      

  2.   

    【VB声明】
      Private Declare Function GetDesktopWindow Lib "user32" Alias "GetDesktopWindow" () As Long【说明】
      获得代表整个屏幕的一个窗口(桌面窗口)句柄 【返回值】
      Long,桌面窗口的句柄 【备注】
      所有桌面图标都在这个窗口里拒绝。它也用于各类屏幕保护程序
      

  3.   

    Private Type RECT
        Left As Long
        Top As Long
        Right As Long
        Bottom As Long
    End Type
    自定义个RECT类型来接收
    lpRect ---------  RECT,屏幕坐标中随同窗口装载的矩形
      

  4.   

    getsystemmetrics
    Public Declare Function GetSystemMetrics Lib "user32" Alias "GetSystemMetrics" (ByVal nIndex As Long) As Longmsgbox getsystemmetrics(0)  '参数0为水平象素,1为垂直象素
      

  5.   

    Private Type RECT
        Left As Long
        Top As Long
        Right As Long
        Bottom As Long
    End Type
    Private Declare Function GetWindowRect Lib "user32" (ByVal hwnd As Long, lpRect As RECT) As Long
    Private Declare Function GetDesktopWindow Lib "user32" () As Long
    Private Declare Function GetSystemMetrics Lib "user32" (ByVal nIndex As Long) As Long  
    Private Sub Command1_Click()
    Dim retResult As RECT
    GetWindowRect GetDesktopWindow(), retResult
    Text1.Text = retResult.Left
    Text2.Text = retResult.TopText3.Text = retResult.Right
    Text4.Text = retResult.BottomText5.Text = GetSystemMetrics(0)
    Text6.Text = GetSystemMetrics(1)End Sub
      

  6.   

    1.Debug.Print Screen.Width / Screen.TwipsPerPixelX
        Debug.Print Screen.Height / Screen.TwipsPerPixelY2.Debug.Print GetSystemMetrics(SM_CXSCREEN)
        Debug.Print GetSystemMetrics(SM_CYSCREEN)
    Private Declare Function GetSystemMetrics Lib "user32" (ByVal nIndex As Long) As Long
    Private Const SM_CXSCREEN = 0
    Private Const SM_CYSCREEN = 1
      

  7.   

    '声明API函数
    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 LongDim DisplayX As Integer
    Dim DisplayY As Integer
    Dim Disting as StringCall DeviceInfo(DisplayX, DisplayY)Disting = DisplayX & "x" & DisplayY还可以改色深哦
      

  8.   

    http://expert.csdn.net/Expert/topic/1447/1447078.xml?temp=.6008875
      

  9.   

    Dim intScreenWidth As Integer
    Dim intScreenHeight As Integer
        
    intScreenWidth = Screen.Width / Screen.TwipsPerPixelX
    intScreenHeight = Screen.Height / Screen.TwipsPerPixelY
        
    MsgBox intScreenWidth & "*" & intScreenHeight