Detecting Screen Resolution

Does anybody have a routine for detecting the PC's current screen resolution in VB? I have OCX's that do that at the moment, but I want to put my own little piece of code in, so that I don't have to include the OCX in the program. Thanx in advance.


Comments

  • Actually, the easiest way (I know of) is to divide the width of the screen (screen.width) in twips with the numbers of twips per X pixel (screen.twipsperpixelx) and to do the same with sceen.height and screen.twipsperpixely.


    : Does anybody have a routine for detecting the PC's current screen resolution in VB? I have OCX's that do that at the moment, but I want to put my own little piece of code in, so that I don't have to include the OCX in the program. Thanx in advance.







  • try this


    Private Type RECT

    Left As Long

    top As Long

    Right As Long

    Bottom As Long

    End Type


    dim vrect as rect

    dim screenhandle as long


    Private Declare Function GetDesktopWindow Lib "user32" () As Long

    Private Declare Function GetWindowRect Lib "user32" (ByVal hwnd As Long, lpRect As RECT) As Long




Sign In or Register to comment.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Categories