I've noticed that if you change from window to full screen and back again (or you change screen resolutions), GLBASIC_HWND() returns an invalid handle.
What code did you use? It's almost impossible.
I use the following to centre a window :
FUNCTION CentreWindow:
INLINE
#ifdef WIN32
struct __RECT desk;
struct __RECT window;
HWND hWnd;
hWnd=(HWND) GLBASIC_HWND();
::GetWindowRect(::GetDesktopWindow(),&desk);
if (::GetWindowRect(hWnd,&window)==0)
{
}
::SetWindowPos(hWnd,HWND_NOTOPMOST,(desk.right-(window.right-window.left)) / 2, (desk.bottom-(window.bottom-window.top)) / 2, 0, 0, SWP_NOSIZE);
#endif
ENDINLINE
ENDFUNCTION
which centres a window to the current desktop window.
I find that after a screen resolution change (especially from window to full screen and then back to window again), the second GetWindowRect fails (GetLastError() at this point would return a value of 1400 - ERROR_INVALID_WINDOW_HANDLE), which, of course means the window cant be centred.