Menu

#695 Maximize and/or Coordinates error with large text font.

closed
5
2012-08-14
2009-05-19
ldanver
No

I am trying to get the entire screen size in a Rexx program. Parts of the method I use is copied from the sample program C:\Program Files\ooRexx\samples\winsystem\usewmgr.rex. I just added the Maximize to get size of the largest window.

This issue seems to be related to the adjusted font size I use on my Vista (64-bit) system. It apparently works correctly on my XP (32-bit) PC, even with an adjusted font size.

Discussion

  • ldanver

    ldanver - 2009-05-19

    Test program

     
  • Mark Miesfeld

    Mark Miesfeld - 2009-05-19

    Larry,

    This is not an ooRexx bug.

    The coordinates() method simply calls the underlying GetWindowRect() Windows API and returns what GetWindowRect() returns. If there is a bug, it is a Windows bug in GetWindowRect()

    I ran your sample on the system I'm currently using and the results look right to me.

    Getting the window rectangle of a maximized window is not the best way to try and determine the current screen size.

    Why don't you use:

    / MyScreenSize /
    s = screenSize()
    say 'My screen size is:' s[3] 'pixels by' s[4] 'pixels.'

    ::requires 'oodWin32.cls'

    Which produces on my system:

    C:\work.ooRexx\bugs\screen.size>MyScreenSize.rex
    My screen size is: 1280 pixels by 1024 pixels.

    C:\work.ooRexx\bugs\screen.size>

    And is exactly correct.

     
  • Mark Miesfeld

    Mark Miesfeld - 2009-05-19

    Larry,

    I suspect you are trying to determine the work area of the screen, which is the area of the screen minus the task bar, sidebar, and application desktop toolbars.

    Windows provides an API to query that directly, but we don't expose that API in any of the Windows extensions.

    You could open up a RFE and ask to expose the Windows SystemParametersInfo() API. In ooDialog I've exposed the GetSystemMetrics() API, which is useful. SystemParametersInfo() could be useful to many people.

    Here is another way to get the size of a maximized window. But, again, this merely returns what the OS says.

    / MyScreenSize /
    s = screenSize()
    say 'My screen size is:' s[3] 'pixels by' s[4] 'pixels.'

    SM_CXMAXIMIZED = 61
    SM_CYMAXIMIZED = 62

    winX = .DlgUtil~getSystemMetrics(SM_CXMAXIMIZED)
    winY = .DlgUtil~getSystemMetrics(SM_CYMAXIMIZED)

    say 'Maxizmized window size is:' winX 'pixels by' winY 'pixels.'

    ::requires 'oodWin32.cls'

    Remember, a maximized window is going to be postitioned partially off the screen, so the size is going to be slightly larger than the actual screen area.

    On Vista you have that sidebar thing, that may be what is giving you funny results.

     
  • Mark Miesfeld

    Mark Miesfeld - 2009-05-20

    Closing this. The values, right or wrong, come directly from the operating system. ooRexx simply reports them.

     

Anonymous
Anonymous

Add attachments
Cancel