Results 1 to 10 of 10

Thread: One API Question..

  1. #1

    Thread Starter
    Member
    Join Date
    Feb 1999
    Posts
    56

    Cool

    Hey there...

    I haven't a clue how to find out the screen size the monitor size (15", 17", 19" etc...)

    Anyone can help?

    Tnx,

    keetsh

  2. #2
    Frenzied Member
    Join Date
    Mar 2000
    Posts
    1,089
    You can't I'm afraid, the moiter doesn't give any information to the computer about what size it is, the graphics card doesn't need to know how big the screen is, the monitor handles it all.

  3. #3
    Guest
    But you can use screen.height and screen.width to determin (i think) resolution.


  4. #4

    Thread Starter
    Member
    Join Date
    Feb 1999
    Posts
    56

    Unhappy

    Well thanks Sam but I've seen a program getting that info... so I was quite surprised... Because I've to find out how many pixels make an inch and so.

    See you,

    keetsh®


  5. #5
    Fanatic Member
    Join Date
    Feb 2000
    Location
    Japan
    Posts
    840
    I suppose that if the monitor was an installed P&P monitor then it may be stored in the registry but most systems are like mine "Unknown Monitor" the system really doesn't know or care how many inches (or centermeters in some countries) it is. The graphics card sends raster data in it's configured resolution type and the monitor does the rest.

    In fact it makes no difference if a monitor is not even connected.

    There maybe some monitors that come with software which it specifically talks to....

    but if you send me a piece of code that can tell me how big my monitor is I'll be VERY impressed.

    Paul Dwyer
    Network Engineer
    Aussie In Tokyo

    Using Powerbasic 6 & VB6 SP4 (Please also add your VB Version to your signature!)

  6. #6

    Thread Starter
    Member
    Join Date
    Feb 1999
    Posts
    56
    Yes Paul the computer does determine whether the monitor is connected or not. I'm gonna have look in the registry and keep you up to date with this.

    See you,

    keetsh

  7. #7
    Fanatic Member
    Join Date
    Feb 2000
    Location
    Japan
    Posts
    840
    No it doesn't !

    If the computer knew what the monitor was doing and displaying you wouldn't have test screens in NT and 15sec wait intervals in 95' to let the use tell the OS what is happening.

    Apple MACs used to have something like that though

    Paul Dwyer
    Network Engineer
    Aussie In Tokyo

    Using Powerbasic 6 & VB6 SP4 (Please also add your VB Version to your signature!)

  8. #8

    Thread Starter
    Member
    Join Date
    Feb 1999
    Posts
    56

    Red face

    Well,

    I'm not sure though because I once bugged mine when I unplugged my monitor and ran Windows. It was Win98 though... anyway that's not quite the matter of the subject.. I'll mail you when I finish something kewl...

    See you,

    keetsh

  9. #9
    Lively Member
    Join Date
    Apr 2000
    Location
    Hell
    Posts
    89

    Lightbulb

    No guarantees as to the reliablity of this method.

    Wait, I take that back.

    I guarantee this method is as reliable as Win95 is after it's been running for a week.

    If you get a screen device context (GetDC(0)), theres a function called GetDeviceCaps that retrieves information on the device context's capabilities (bits per pixel, etc).
    Some potentially useful requests:

    HORZSIZE Width, in millimeters, of the physical screen.
    VERTSIZE Height, in millimeters, of the physical screen.
    LOGPIXELSX Number of pixels per logical inch along the screen width. In a system with multiple display monitors, this value is the same for all monitors.
    LOGPIXELSY Number of pixels per logical inch along the screen height. In a system with multiple display monitors, this value is the same for all monitors.


    - Steve

    Real programmers use COPY CON PROGRAM.EXE

  10. #10
    Guest

    Wink

    Usually, you want to find out resolution instead of actual screen size. For example, one of our programs is designed to be run on laptops and must be run at 1024x768. We use the following function:

    Code:
    Function checkScreenRes(stringIn As String) As Boolean
      Select Case stringIn
        Case "1024x768"
          If Screen.Width / Screen.TwipsPerPixelX >= 1024 And _
             Screen.Height / Screen.TwipsPerPixelY >= 768 Then
            checkScreenRes = True
          Else
            checkScreenRes = False
          End If
        ' TODO: Add other screen sizes here as Cases
      End Select
    End Function
    As long as the display is set at 1024x768, we don't care if its a 14" or 12" or even a 9" display panel.

    Hope that helps.
    -John

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width