My framework handles this. This code won't run on it's own (I've just pasted it in) but you get the idea:
Extern "win32" Function GetWindowRect%(hWnd%, lpRect: Byte Ptr) End Extern Type TRect Field L%, T%, R%, B% End Type 'Quickly check to see if the window has moved. 'If it has, this is because the user has dragged it and so we should 'reset the timing variables. Local Rect:TRect = ccWindowPositionHandle(Game.WindowHandle) ?Win32 If Game.WindowX <> Rect.L Or Game.WindowY <> Rect.T Then Init() Game.SetWindowCoords() Game.SetClientCoords() EndIf ? ' ----------------------------------------------------------------------------- ' ccWindowPositionHandle: Uses Windows API call to return a TRect containing a window's position ' ----------------------------------------------------------------------------- Function ccWindowPositionHandle:TRect(hWnd%) 'Pass a handle to a window in. ?Win32 Local window:TRect= New TRect GetWindowRect(hWnd,window) Return window ? End Function