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...
This'll work with GetWindowRect() as declared in PUB.Win32, which expects an Int Ptr.
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.