How to add a Windowicon + Center Window? (again)

BlitzMax Forums/BlitzMax Programming/How to add a Windowicon + Center Window? (again)

The forum is locked. These are the original blitzbasic.com forums, kept so they can still be read. No new topics, replies or edits can be made here. To join in, head over to the Blitz3D+ forums.

I meant for you to use the above code as an example of using GetWindowRect() with an array.

Anyway, I've tweaked GA's code to use arrays...
Function ccCentreWindowHandle(hWnd%)
	'Centres the current graphics window on the desktop
	'Pass a handle in
	?Win32
		Local desk[4]'[left, top, right, bottom]
		Local window[4]'ditto
	
		GetWindowRect(GetDesktopWindow(), desk) ' Get Desktop Dimensions
	    'Get Window Dimensions because final window may have been resized (by BlitzMax) to fit the desktop resultion! (Grey Alien)
		GetWindowRect(hWnd, window)
		
		'Centre Window
		SetWindowPos(hWnd, HWND_NOTOPMOST, (desk[2] - (window[2] - window[1])) / 2, (desk[3] - (window[3] - window[0])) / 2, 0, 0, SWP_NOSIZE)	
	?
End Function


This'll work with GetWindowRect() as declared in PUB.Win32, which expects an Int Ptr.