How do I move the Graphics Windows position?

BlitzMax Forums/BlitzMax Programming/How do I move the Graphics Windows position?

WERDNA(Posted 2010) [#1]
Hey!

Just wondering how I would move the graphics windows position, without having
to click and drag with the mouse.

I need the window to start in a random location on the screen(Don't ask), and
as it is it always starts in the center ;(


therevills(Posted 2010) [#2]
Windows Only:

SuperStrict
SeedRnd MilliSecs()
Const SCREEN_WIDTH% = 800, SCREEN_HEIGHT% = 600

Graphics SCREEN_WIDTH, SCREEN_HEIGHT
setWindowPosition(Rand(1024), Rand(800))

While Not AppTerminate()
	For Local i% = 0 To 100
		SetColor Rand(255),Rand(255),Rand(255)
		Plot Rand(SCREEN_WIDTH),Rand(SCREEN_HEIGHT)
	Next
	If KeyHit(KEY_SPACE) setWindowPosition(Rand(1024), Rand(800))
	Flip
Wend

Function setWindowPosition(x%, y%)
	?Win32
		SetWindowPos(GetActiveWindow(), HWND_NOTOPMOST, x , y, 0, 0, SWP_NOSIZE)	
	?
End Function



ImaginaryHuman(Posted 2010) [#3]
If you have MaxGUI you can open the window wherever you want and reposition it whenever you want.


WERDNA(Posted 2010) [#4]
Thanks therevills!

And yes I DO have MaxGUI :)

But I probably don't need to bother with what I'm doing. Its a pretty small program.


Thanks!


Xerra(Posted 2010) [#5]
You're not writing one of these annoying little programs that moves the window every time someone tries to hit the close gadget, are you? :)

Ctrl,Alt,Delete will see you off, you rascal !!!


WERDNA(Posted 2010) [#6]
lol