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

Ratch

To the Ineffable All,
     I can't seem to get WS_MAXIMIZE or WS_MINIMIZE to work when I use it for the CreateWindow API. It appears these window style parameters are ignored.  Can anybody shed some liight on this prob.  Ratch

PBrennick

Ratch,
Try WS_OVERLAPPEDWINDOW

It will set the following attributes:

Quote
WS_OVERLAPPED OR WS_CAPTION OR WS_SYSMENU OR WS_THICKFRAME OR WS_MINIMIZEBOX OR WS_MAXIMIZEBOX

Notice WS_MINIMIZEBOX OR WS_MAXIMIZEBOX, anyway that is how it is set in windows.inc and is what I use.

Paul
The GeneSys Project is available from:
The Repository or My crappy website

Ratch

PBrennick,
     I do use WS_OVERLAPPEDWINDOW, and I do get all the size boxes, but that is not my problem.  I want the window to initially show at the max size upon program startup. WM_MAXSIZE is supposed to make that happen, but it doesn't.   Ratch

QvasiModo

Are you calling ShowWindow after the creation of the window?

Ratch

QvasiModo,
Quote
Are you calling ShowWindow after the creation of the window?

     Certainly, otherwise I would not see a window at all.  My problem is not that I don't see a window; it is that I don't see it initially maximized. Why not try it yourself and see if you can get a window initially maximized.  Ratch

hutch--

Ratch,

When I need a maximised window, I use ShowWindow() with the SW_SHOWMAXIMIZED flag.


    push SW_SHOWMAXIMIZED
    push hWnd
    call ShowWindow


It has always worked fine
Download site for MASM32      New MASM Forum
https://masm32.com          https://masm32.com/board/index.php

PBrennick

Quote
I want the window to initially show at the max size upon program startup.

It would have been helpful if you had said that in the initial post.

Paul
The GeneSys Project is available from:
The Repository or My crappy website

Ratch

Hutch,
     Your SW_SHOWMAXIMIZED solution certainly works.  Still, according to the documentation, WS_MAXIMIZE is supposed to work also. Ratch

PBrennick,
     Doesn't CreateWindow imply a startup condition? Ratch

QvasiModo

Quote from: Ratch on November 16, 2005, 09:31:36 PM
QvasiModo,
Quote
Are you calling ShowWindow after the creation of the window?

     Certainly, otherwise I would not see a window at all.  My problem is not that I don't see a window; it is that I don't see it initially maximized. Why not try it yourself and see if you can get a window initially maximized.  Ratch

It's still strange, because you shouldn't really need to call ShowWindow after window creation. Perhaps you were passing it a SW_DEFAULT or SW_SHOWNORMAL value and that was overriding whatever window styles you were using.

G`HOST

Quote from: QvasiModo on November 17, 2005, 04:36:29 PM
, because you shouldn't really need to call ShowWindow after window creation. 
Well we do need to call showWindow to make it display on the screen ,or we dont ???

Quote from: QvasiModo on November 17, 2005, 04:36:29 PM
Perhaps you were passing it a SW_DEFAULT or SW_SHOWNORMAL value and that was overriding whatever window styles you were using.
Ya i think the same .if u pass the default window size in the createWindow call and then call ShowWindow with nCmdShow set to SW_SHOWDEFAULT or  SW_SHOWNORMAL then u wont get a maximized window.
But one question arises if we cant display our window without showWindow call and nCmdShow in it overrides the WS_MAXIMIZE in createWindow call then why the hell these flags(WS_MAXIMIZE or WS_MINIMIZE) are ment for.And if, only if we can display the window without calling ShowWindow(Which i doubt) then what should we put in " x,y,height,weidth "section of the CreateWindow call if Style==WS_MAXIMIZE??

Ratch

G`HOST,
     Yes, ShowWindow with SW_MAXIMIZE does work, but it is a workaround.  One should be able to specify a max window in CreateWindow.  Ratch

arafel

Ratch,
WM_MAXIMIZE works only when size related parameters are set to:

x = CW_USEDEFAULT
y = SW_MAXIMIZE
nWidth = CW_USEDEFAULT
nHeigh = SW_MAXIMIZE


G`HOST,
Actually we don't. Window displays just fine if WM_VISIBLE flag is specified. ShowWindow is not required.

Ratch

arafel,
Quote
WM_MAXIMIZE works only when size related parameters are set to:

x = CW_USEDEFAULT
y = SW_MAXIMIZE
nWidth = CW_USEDEFAULT
nHeigh = SW_MAXIMIZE


     You really meant WS_MAXIMIZE, didn't you?  Anyhow, I doubt it.  WS_MAXIMIZE is a STYLE param, and not to be used to specify position and size of a window.  Ratch

arafel

Oh, yes i meant WS_MAXIMIZE.

And i didn't say to use it instead of the size parameters. This what i was talking about:

invoke   CreateWindowEx, 0, ADDR my_class, 0, WS_VISIBLE or WS_MAXIMIZE or WS_SYSMENU, CW_USEDEFAULT, SW_MAXIMIZE, CW_USEDEFAULT, SW_MAXIMIZE, 0, 0, hInstance, 0

works fine for me (providing there is no ShowWindow after it, which could override the current window display mode)

tenkey

Under certain conditions, the first window created will ignore WS_MAXIMIZE and WS_MINIMIZE. Instead, it will use the wShowWindow setting in the STARTUPINFO structure used by CreateProcess. This is known behavior for NT and Win95, and it was documented in the SDKs for those platforms. Haven't checked if this still happens on the newer OS's. Calling ShowWindow after creating the window will override that behavior - the first ShowWindow wasn't supposed to override the behavior.
A programming language is low level when its programs require attention to the irrelevant.
Alan Perlis, Epigram #8