No window frame when going from full screen back to windowed mode

Started by
9 comments, last by howie_007 11 years, 3 months ago
Are you setting the new window style *after* resetting the device? All you need to do after resetting the device is call SetWindowLong() to set the new window style, and then SetWindowPos() with the SWP_FRAMECHANGED flag to flush the changes.

yep... I tried it before the reset... after the reset... before and after the reset. A zillion tests later, gave up.

Even though I removed some of the original posted code displayed above, I added the below test code (after the reset) just to reconfirm I'm not crazy and yep, no window frame. Unless there's something else I'm missing, the below code doesn't work.


if( !CSettings::Instance().GetFullScreenChange() )
{
	SetWindowLong( hWnd, GWL_STYLE, WS_OVERLAPPED|WS_SYSMENU|WS_MINIMIZEBOX );
	SetWindowLong( hWnd, GWL_EXSTYLE, WS_EX_WINDOWEDGE );

	// Adjust the rect so that the client size of the window is the exact size of the needed resolution
	AdjustWindowRectEx( &rect, GetWindowStyle(hWnd), GetMenu(hWnd) != NULL, GetWindowExStyle(hWnd) );

	// Position the window in the center of the screen
	SetWindowPos( hWnd,
			HWND_NOTOPMOST,
			((GetSystemMetrics( SM_CXSCREEN ) - (rect.right-rect.left)) / 2), 
			((GetSystemMetrics( SM_CYSCREEN ) - (rect.bottom-rect.top)) / 2),
			rect.right - rect.left,
			rect.bottom - rect.top,
			SWP_SHOWWINDOW|SWP_FRAMECHANGED );
}
else
{
	SetWindowLong( hWnd, GWL_STYLE, WS_POPUP|WS_VISIBLE );
	SetWindowLong( hWnd, GWL_EXSTYLE, WS_EX_TOPMOST );

	SetWindowPos( hWnd,
			HWND_NOTOPMOST,
			0, 
			0,
			0,
			0,
			SWP_SHOWWINDOW|SWP_FRAMECHANGED|SWP_NOSIZE );
}

This topic is closed to new replies.

Advertisement