Like Tree1Likes
  • 1 Post By novacain

WM_GETMINMAXINFO problem when window is maximized

This is a discussion on WM_GETMINMAXINFO problem when window is maximized within the Windows Programming forums, part of the Platform Specific Boards category; I want to reduce (by 1 only pixel) the height of a window when it is show maximized. In my ...

  1. #1
    Registered User
    Join Date
    Feb 2013
    Posts
    1

    Post WM_GETMINMAXINFO problem when window is maximized

    I want to reduce (by 1 only pixel) the
    height of a window when it is show maximized.
    In my window procedure I have
    the following code in C++:


    case WM_GETMINMAXINFO:
    LPMINMAXINFO
    minmaxinfopunt = (LPMINMAXINFO) lParam;
    minmaxinfopunt->ptMaxSize.y -=
    1;
    return 0;


    Now a strange thing happen:
    - with values from 1
    to 16 (that is, from "minmaxinfopunt->ptMaxSize.y -= 1;" to
    "minmaxinfopunt->ptMaxSize.y -= 16;") I always get the height previously
    memorized in ptMaxSize.y, that is, the mazimized (by the system) height of the
    window.

    - with values equal or greater than 17 I get the height of the
    window reduced as aspected.

    I can I solve this problem?
    Thanks.
    Last edited by Salem; 02-11-2013 at 10:14 AM. Reason: removed pointless tags

  2. #2
    Registered User
    Join Date
    Jan 2009
    Location
    Australia
    Posts
    375
    I thought your question was interesting so I did some research. For some reason or other the maximised size of a window on my screen is actually 8 pixels larger than my screen resolution. Your problem should be fixed by simply using the horizontal resolution of your screen instead of the value in ptMaxSize.y

    Remember to also subtract the size of the taskbar. From memory I believe this is easily accomplished by GetSystemMetrics.

    If a windows guru would like to step in to say why windows are created that are bigger than my screen, I would love to know!

  3. #3
    train spotter
    Join Date
    Aug 2001
    Location
    near a computer
    Posts
    3,859
    Quote Originally Posted by DeadPlanet View Post
    I thought your question was interesting so I did some research. For some reason or other the maximised size of a window on my screen is actually 8 pixels larger than my screen resolution. Your problem should be fixed by simply using the horizontal resolution of your screen instead of the value in ptMaxSize.y

    Remember to also subtract the size of the taskbar. From memory I believe this is easily accomplished by GetSystemMetrics.

    If a windows guru would like to step in to say why windows are created that are bigger than my screen, I would love to know!
    My understanding is that Windows creates a maximised size slightly bigger than the screen to hide the (3D) borders.

    As borders are generally 4 pixels wide you get a rect of -4, -4, MAX_X_RES + 4, MAX_Y_RES + 4

    Y
    DeadPlanet likes this.
    "Man alone suffers so excruciatingly in the world that he was compelled to invent laughter."
    Friedrich Nietzsche

    "I spent a lot of my money on booze, birds and fast cars......the rest I squandered."
    George Best

    "If you are going through hell....keep going."
    Winston Churchill

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Creating and showing a maximized window
    By megafiddle in forum Windows Programming
    Replies: 8
    Last Post: 09-11-2011, 01:53 AM
  2. MDI children always maximized?
    By Devils Child in forum Windows Programming
    Replies: 4
    Last Post: 02-25-2009, 06:43 AM
  3. show window minimized maximized without focus taken
    By eXistenZ in forum Windows Programming
    Replies: 16
    Last Post: 12-15-2008, 11:38 AM
  4. starting with a maximized window
    By bluehead in forum Windows Programming
    Replies: 4
    Last Post: 05-27-2002, 08:08 PM
  5. How to open window maximized
    By Unregistered in forum Windows Programming
    Replies: 5
    Last Post: 02-04-2002, 03:29 PM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21