Device's windowed
When I set D3DPresentParams.windowed = true, it failed to create the device. Then I reboot my computer and complie it. It works fine . Uh, My question is why? did I miss something?
oh, sorry, here my code
P.S. how I do make display as visual C++'s version?
[edited by - Starfalcon2 on May 31, 2004 1:04:30 PM]
HRESULT hResult = CreateD3DObject(); if (hResult != D3D_OK) return hResult; hResult = CheckDisplayMode(); if (hResult != D3D_OK) return hResult; hResult = CreateD3DDevice(); if (hResult != D3D_OK) return hResult;//////////////////////////////////////////////////////// CreateD3DObject()//////////////////////////////////////////////////////HRESULT CDirect3D::CreateD3DObject(){ m_pD3D = Direct3DCreate8(D3D_SDK_VERSION); if (m_pD3D == NULL) { MessageBox(m_hWnd, "Couldn’t create DirectX object.", "DirectX Error", MB_OK); strcpy(m_szErrorMsg, "CreateD3DObject()"); return E_FAIL; } return D3D_OK;}//////////////////////////////////////////////////////// CheckDisplayMode()//////////////////////////////////////////////////////HRESULT CDirect3D::CheckDisplayMode(){ HRESULT hResult = m_pD3D->CheckDeviceType(D3DADAPTER_DEFAULT, D3DDEVTYPE_HAL, D3DFMT_X8R8G8B8, D3DFMT_X8R8G8B8, FALSE); if (hResult != D3D_OK) { MessageBox(m_hWnd, "The required display mode is not available on this system.", "DirectX Error", MB_OK); strcpy(m_szErrorMsg, "CheckDisplayMode()"); return hResult; } return D3D_OK;}//////////////////////////////////////////////////////// CreateD3DDevice()//////////////////////////////////////////////////////HRESULT CDirect3D::CreateD3DDevice(){ D3DPRESENT_PARAMETERS D3DPresentParams; ZeroMemory(&D3DPresentParams, sizeof(D3DPRESENT_PARAMETERS)); D3DPresentParams.Windowed = true; D3DPresentParams.BackBufferCount = 1; D3DPresentParams.BackBufferWidth = 640; D3DPresentParams.BackBufferHeight = 480; D3DPresentParams.BackBufferFormat = D3DFMT_X8R8G8B8; D3DPresentParams.SwapEffect = D3DSWAPEFFECT_DISCARD; D3DPresentParams.hDeviceWindow = m_hWnd; HRESULT hResult = m_pD3D->CreateDevice(D3DADAPTER_DEFAULT, D3DDEVTYPE_HAL, m_hWnd, D3DCREATE_SOFTWARE_VERTEXPROCESSING, &D3DPresentParams, &m_pD3DDevice); if (FAILED(hResult)) { MessageBox(m_hWnd, "Failed to create Direct3D device.", "DirectX Error", MB_OK); strcpy(m_szErrorMsg, "CreateD3DDevice()"); return hResult; } return hResult;}
P.S. how I do make display as visual C++'s version?
[edited by - Starfalcon2 on May 31, 2004 1:04:30 PM]
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement