Sign in to follow this  
zalthar

Wierd?

Recommended Posts

zalthar    122
I have a problem. When Visual Studio .NET runs my program in debug mode (and in release) it skips lines of code.
////////////////////////////////////////////////////////////
// CreateD3DDevice()
////////////////////////////////////////////////////////////
HRESULT CDirect3D::CreateD3DDevice()
{
// ================= INSTEAD OF STARTING HERE!!!
	D3DPRESENT_PARAMETERS D3DPresent_Params;
    ZeroMemory(&D3DPresent_Params, sizeof(D3DPRESENT_PARAMETERS));
    D3DPresent_Params.Windowed = FALSE;
    D3DPresent_Params.BackBufferCount = y;
    D3DPresent_Params.BackBufferWidth = 640;
    D3DPresent_Params.BackBufferHeight = 480;
    D3DPresent_Params.BackBufferFormat = D3DFMT_X8R8G8B8;
    D3DPresent_Params.SwapEffect = D3DSWAPEFFECT_DISCARD;
    D3DPresent_Params.hDeviceWindow = m_hWnd;
    HRESULT hResult = m_pD3D->CreateDevice(D3DADAPTER_DEFAULT,
		D3DDEVTYPE_HAL, m_hWnd, 
// ================= IT STARTS HERE!!!
D3DCREATE_SOFTWARE_VERTEXPROCESSING,
		&D3DPresent_Params, &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;
}
What is wrong? I have tried other applications with the same function and it works. But not with this program. HELP ME! /Zalthar

Share this post


Link to post
Share on other sites
a3a2004    121

{
// ================= INSTEAD OF STARTING HERE!!!
D3DPRESENT_PARAMETERS D3DPresent_Params;
ZeroMemory(&D3DPresent_Params, sizeof(D3DPRESENT_PARAMETERS));
D3DPresent_Params.Windowed = FALSE;
D3DPresent_Params.BackBufferCount = y;
D3DPresent_Params.BackBufferWidth = 640;
D3DPresent_Params.BackBufferHeight = 480;
D3DPresent_Params.BackBufferFormat = D3DFMT_X8R8G8B8;
D3DPresent_Params.SwapEffect = D3DSWAPEFFECT_DISCARD;
D3DPresent_Params.hDeviceWindow = m_hWnd;
HRESULT hResult = m_pD3D->CreateDevice(D3DADAPTER_DEFAULT,
D3DDEVTYPE_HAL, m_hWnd)

you forgot the final parentheses or screwed up the params or both on the createdevice function

Share this post


Link to post
Share on other sites
zalthar    122
No you are wrong the parentes comes after the comment IT STARTS HERE. The thing is that it starts in the middle of the CreateDevice call.

Share this post


Link to post
Share on other sites
zalthar    122
I did notice now that this function doesn't return anything to g_hWnd. Anyone know why?


////////////////////////////////////////////////////////////
// CreateAppWindow()
////////////////////////////////////////////////////////////
void CreateAppWindow(HINSTANCE hInstance)
{
g_hWnd = CreateWindowEx(
NULL,
"Bricker",
"Bricker",
WS_POPUP,
100,
100,
648,
514,
GetDesktopWindow(),
NULL,
hInstance,
NULL);
}

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this