News:

MASM32 SDK Description, downloads and other helpful links
MASM32.com New Forum Link
masmforum WebSite

WS_MAXIMIZE AND WS_MINIMIZE

Started by Ratch, November 16, 2005, 06:40:39 PM

Previous topic - Next topic

arafel

MichaelW, thanks for testing.

For simplicity I haven't include any other styles, so the titlebar appears empty.


P.S. i just tested it with various styles combinations and it sees to work fine.

QvasiModo

Quote from: arafel on November 18, 2005, 11:00:37 PM
Quote from: QvasiModo
BTW, SW_MAXIMIZE should not be passed as a parameter to CreateWindowEx.

do you mean the SW_MAXIMIZE i pass in y parameter?
i think CreateWindow expects it to be SW_MAXIMIZE if WS_MAXIMIZE specified as style and x parameter is CW_USEDEFAULT.

Well, it's not in MSDN. Did you try removing them?

I think CW_USEDEFAULT could be used for the x, y, nWidth and nHeight parameters. Here's a quote from MSDN:
Quote
x
    [in] Specifies the initial horizontal position of the window. For an overlapped or pop-up window, the x parameter is the initial x-coordinate of the window's upper-left corner, in screen coordinates. For a child window, x is the x-coordinate of the upper-left corner of the window relative to the upper-left corner of the parent window's client area. If x is set to CW_USEDEFAULT, the system selects the default position for the window's upper-left corner and ignores the y parameter. CW_USEDEFAULT is valid only for overlapped windows; if it is specified for a pop-up or child window, the x and y parameters are set to zero.

y
    [in] Specifies the initial vertical position of the window. For an overlapped or pop-up window, the y parameter is the initial y-coordinate of the window's upper-left corner, in screen coordinates. For a child window, y is the initial y-coordinate of the upper-left corner of the child window relative to the upper-left corner of the parent window's client area. For a list box y is the initial y-coordinate of the upper-left corner of the list box's client area relative to the upper-left corner of the parent window's client area. If an overlapped window is created with the WS_VISIBLE style bit set and the x parameter is set to CW_USEDEFAULT, the system ignores the y parameter.

nWidth
    [in] Specifies the width, in device units, of the window. For overlapped windows, nWidth is the window's width, in screen coordinates, or CW_USEDEFAULT. If nWidth is CW_USEDEFAULT, the system selects a default width and height for the window; the default width extends from the initial x-coordinates to the right edge of the screen; the default height extends from the initial y-coordinate to the top of the icon area. CW_USEDEFAULT is valid only for overlapped windows; if CW_USEDEFAULT is specified for a pop-up or child window, the nWidth and nHeight parameter are set to zero.

nHeight
    [in] Specifies the height, in device units, of the window. For overlapped windows, nHeight is the window's height, in screen coordinates. If the nWidth parameter is set to CW_USEDEFAULT, the system ignores nHeight.

arafel

Yes, but psdk also mentions in other place, that when specifying WS_VISIBLE style and CW_USEDEFAULT for x parameter, y parameter gets passed to ShowWindow by CreateWindow function (see the psdk quote I posted earlier).

I did tried removing them, with no luck.
The only way I got an initially maximized window on my machine (XP) is: WS_VISIBLE style, CW_USEDEFAULT for x and SW_MAXIMIZE for y.
Although it doesn't explain why WS_MAXIMIZE doesn't work by itself. It wors fine for creating initially minimized/maximized/whatever windows without calling ShowWindow after CreateWindow.

QvasiModo

Quote from: arafel on November 21, 2005, 05:53:54 PM
Yes, but psdk also mentions in other place, that when specifying WS_VISIBLE style and CW_USEDEFAULT for x parameter, y parameter gets passed to ShowWindow by CreateWindow function (see the psdk quote I posted earlier).

I did tried removing them, with no luck.
The only way I got an initially maximized window on my machine (XP) is: WS_VISIBLE style, CW_USEDEFAULT for x and SW_MAXIMIZE for y.

Ah, I see now, sorry :red

Quote
Although it doesn't explain why WS_MAXIMIZE doesn't work by itself. It wors fine for creating initially minimized/maximized/whatever windows without calling ShowWindow after CreateWindow.

Seems like a bug to me, or they broke compatibility with previous Windows versions for some reason... :naughty: