Original Post
Hello, I've tried to make a function for switching between fullscreen and windowed, but encoutered problems.
Code:
It works like this, even the resoliution of screen changes, but could it be called fullscreen (it looks like one though)? The commented code makes m_pDevice->Clear(...); function fail. Mainly because I change pp.Windowed to false. What might be causing it?
CWindow::ChangeWindowMode(); changes the width, height and dwstyle of the window to match that of a fullscreen.
Code:
[source=c++]HRESULT CDirect3D::ChangeWindowMode(){ CWindow::ChangeWindowMode(); D3DPRESENT_PARAMETERS pp; ZeroMemory(&pp, sizeof(pp)); RECT rc; GetClientRect(m_hWindow, &rc); //pp.AutoDepthStencilFormat = D3DFMT_D16; //pp.BackBufferCount = 1; //pp.BackBufferFormat = D3DFMT_UNKNOWN; // D3DFMT_UNKNOWN - Uses desktop bit depth. //pp.BackBufferHeight = rc.bottom; //pp.BackBufferWidth = rc.right; //pp.EnableAutoDepthStencil = TRUE; // TRUE - Indicate that application manages depth buffers. //pp.hDeviceWindow = m_hWindow; //pp.PresentationInterval = D3DPRESENT_INTERVAL_IMMEDIATE; // D3DPRESENT_INTERVAL_ONE - monitors refresh rate in Hz, D3DPRESENT_INTERVAL_IMMEDIATE - maximum refresh rate. //pp.SwapEffect = D3DSWAPEFFECT_DISCARD; // D3DSWAPEFFECT_DISCARD - allows video card to control swapping. //pp.Windowed = FALSE; pp.AutoDepthStencilFormat = D3DFMT_D16; pp.BackBufferCount = 1; pp.BackBufferFormat = D3DFMT_UNKNOWN; // D3DFMT_UNKNOWN - Uses desktop bit depth. pp.EnableAutoDepthStencil = TRUE; // TRUE - Indicate that application manages depth buffers. pp.hDeviceWindow = m_hWindow; pp.PresentationInterval = D3DPRESENT_INTERVAL_IMMEDIATE; // D3DPRESENT_INTERVAL_ONE - monitors refresh rate in Hz, D3DPRESENT_INTERVAL_IMMEDIATE - maximum refresh rate. pp.SwapEffect = D3DSWAPEFFECT_DISCARD; // D3DSWAPEFFECT_DISCARD - allows video card to control swapping. pp.Windowed = TRUE; m_pDevice->Reset(&pp); return S_OK;}It works like this, even the resoliution of screen changes, but could it be called fullscreen (it looks like one though)? The commented code makes m_pDevice->Clear(...); function fail. Mainly because I change pp.Windowed to false. What might be causing it?
CWindow::ChangeWindowMode(); changes the width, height and dwstyle of the window to match that of a fullscreen.

