Can I set the position of the window?

BlitzMax Forums/BlitzMax Beginners Area/Can I set the position of the window?

AndrewT(Posted 2009) [#1]
Pretty straightforward--is there a way to set the position of the window?


plash(Posted 2009) [#2]
Of the window created by a Graphics call?
In that case, yes.. but you'll need to do some Windows API stuff.


AndrewT(Posted 2009) [#3]
Thank you, I got it figured out. I never knew how easy it was to access the Windows API from BlitzMax.

Here's what I came up with in case anybody else has the same question.

Extern "win32"

	Function GetActiveWindow:Byte Ptr()
	Function SetWindowPos:Int(hWnd:Byte Ptr, hWndInsertAfter:Byte Ptr, X:Int, Y:Int, CX:Int, CY:Int, Flags:Int)

EndExtern

Local WindowX:Int = 100
Local WindowY:Int = 100

SetWindowPos(GetActiveWindow(), Byte Ptr(0), WindowX, WindowY, 0, 0, $0001)



markcw(Posted 2009) [#4]
Andrew, are you using multiple windows? Just curious.

Would be nice to have this added to MaxGUI or at least a cross-platform solution.


AndrewT(Posted 2009) [#5]
Nope, just one.