Win32: How to position a window at CW_USEDEFAULT?

BlitzMax Forums/BlitzMax Programming/Win32: How to position a window at CW_USEDEFAULT?

Fabian.(Posted 2005) [#1]
Is there anyway to position a window at the system default position? I need this because I don't want to use constant window sizes or to store sizes in a file.


Grisu(Posted 2005) [#2]
Not sure what you mean by system default?!?


You can position the app window using this code.

Just save the xy position set at the end of the program.
And read it from a file at start up.




Perturbatio(Posted 2005) [#3]
CW_USEDEFAULT has to be specified at window creation, the bmax code as it stands doesn't allow you to do this.


Fabian.(Posted 2005) [#4]
So, there's no const for BMX's CreateWindow's x, y, w and h params?
...Isn't there any other way?


Moogles(Posted 2006) [#5]
well if you could create windows hidden, like in maxgui, then show them after you repositioned to the center with that code, then it would be nicer. thats for windows created by maxgui. to center an app with the graphics function you should read my post here
http://blitzmax.com/Community/posts.php?topic=57449
you need maxgui for it to work but it works. although if i knew how to find the size of the desktop without maxgui i would.

[edit] i used the above code and modified some modules. Now it works without MaxGUI!!!! :D


Fabian.(Posted 2006) [#6]
Sorry; but I'm talking about MaxGUI.
I want to create a window with the CreateWindow function, but different to the Win32 CreateWindowExW function the CreateWindow function doesn't allow a constant to position the window at a position thought out by the operating system. And I think this value is the best to position a window to.


Fabian.(Posted 2006) [#7]
So I simply request a Win32's CW_USEDEFAULT constant equivalent in MaxGUI.
It could be any value defined as const int, for example Const WINDOW_DEFAULTCOORD = 2147483647 which courses the MaxGUI CreateWindow function to to use a system default value for positioning/sizing the window.


Regular K(Posted 2006) [#8]
Id like that also, it comes in use. I don't wanna store all of the window positions in a file, but I don't wanna have them all centered or in the place I put them for testing.


Fabian.(Posted 2006) [#9]
Exactly that's the reason I requested this for; and, if the system positions the windows, they are positioned lowered and indented to the window created before:

So if window positioning is a system's task it's easier for the user to work with these windows.

Such a constant would be additional and optional, so if anyone wants to do so, this person still can set the window position manually.