Reposition a graphics window

BlitzPlus Forums/BlitzPlus Programming/Reposition a graphics window

julianbury(Posted 2007) [#1]
My game runs in a graphics window.
First thing it does is get the desktop size.
Then it calculates allowances for its own frame size to cover the desktop except of the toolbar at the bottom.

The problem with toolbars is that they can be different sizes according to user's preferences.

I wish to leave toolbars uncovered for the user's convenience, so I leave a generous gap (96 pixels) at the bottom.

But that does not work because the game window auto-centers, leaving a gap at the top and covering part of the toolbar or being partly covered by the toolbar which wipes out the score legends.

So I must stop the window auto-centering and making the default position to be top of the screen.

I also need to find the toolbar's height so I can leave that uncovered, too.

Since I wrote the game in the pure graphics mode ...

xres=GadgetWidth(Desktop()) - 6
yres=GadgetHeight(Desktop()) - 96
Graphics xres,yres,0,2

... I cannot find a way to stick the window to the top of the screen.

I know I could write it to be small enough to miss everything - but this game benefits greatly from maximizing its space.

Can anyone help, please?

Thank you for you kind attention (-_-)


Dabz(Posted 2007) [#2]
Userlibs and WinAPI function SetWindowPos()

http://msdn2.microsoft.com/en-us/library/ms633545.aspx

I think I have it in here somewhere under ChangeWindowPosition:-

http://www.syntaxbomb.com/forum/index.php/topic,114.0.html

You'll probably need to call the WinAPI function GetActiveWindow to find your windows handle. But I dont use Blitz+ anymore, so there may be a function in there to get it.

Dabz