I've searched for about 2 hours around the web for a guide on how to switch a window from windowed to full screen after runtime.
I can do it fine at run time but I want to be able to switch back and forth.
I've made this method but when it's called the screen just goes white:
First it creates the new window style and updates the window
//Create new window style
DWORD style = (windowed) ?
WS_OVERLAPPED | WS_CAPTION | WS_SYSMENU | WS_THICKFRAME | WS_MINIMIZEBOX :
WS_EX_TOPMOST | WS_POPUP | WS_VISIBLE;
//set new window style
SetWindowLong(mHwnd, GWL_STYLE, style);
ShowWindow(mHwnd, SW_SHOW);
UpdateWindow(mHwnd);
then updates the present parameters for the device
mPresent.hDeviceWindow = mHwnd;
mPresent.Windowed = (windowed) ? TRUE : FALSE;
mPresent.BackBufferFormat = (windowed) ? D3DFMT_UNKNOWN : D3DFMT_X8R8G8B8;
mPresent are the present parameters used initially to create the device so I just update the values that need to be changed.
Next I call reset with the new parameters
hr = mDevice->Reset(&mPresent);
if (FAILED(hr))
{
if(hr == D3DERR_DEVICELOST)
ErrMsg("Device Lost");
if(hr == D3DERR_DEVICEREMOVED)
ErrMsg("Device Removed");
if(hr == D3DERR_DRIVERINTERNALERROR)
ErrMsg("Driver Error");
if(hr == D3DERR_OUTOFVIDEOMEMORY)
ErrMsg("Out of memory");
}
After this is done I don't get any of the errors that the MS site says it returns so none of the messages are shown but if I check if hr has failed I do get an error and hr has the value -2005530516
So what am I doing wrong? I keep seeing something about "state blocks" being released before calling Reset but I have no idea what they are and presume I haven't used any that need to be released.
So, any idea how to go about this correctly?
Thanks, Mal.