Thread: WM_GETMINMAXINFO problem when window is maximized

  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 11: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,868
    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
    "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, 07:43 AM
  3. show window minimized maximized without focus taken
    By eXistenZ in forum Windows Programming
    Replies: 16
    Last Post: 12-15-2008, 12:38 PM
  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, 04:29 PM