Key_46

Hi, i moved back to the C++ due to .Net memory management( slow down my app), anyway.... i recompiled the DirectX's C++ examples (October 2006 SDK) and when i run the examples a error ocurs, in the tutorials(No DXUtils) the error location is more evident:

*this error code is from the Vertices tutorial.

The Error:

Unhandled exception at 0x6604a92f in Vertices.exe: 0xC0000005: Access violation reading location 0x00f2b000.

The Location:

LRESULT WINAPI MsgProc( HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam )
{
switch( msg )
{
case WM_DESTROY:
Cleanup();
PostQuitMessage( 0 );
return 0;
}

return DefWindowProc( hWnd, msg, wParam, lParam );

The error appears at the end of this function . (green arrow in debugger....) -> }

What is happening I will try to update the SDK to December 2006 'cause this error began when i updaded the SDK to October 2006, the strange part is that the application that i created in C++ works normaly....well...not exactly normal....the Direct3DDevice9 parameters in the debugger are "leaked".

thanks
Key_46


Re: Game Technologies: DirectX 101 Again - C++ DirectX Error

Bad Habit

Sounds like a duff pointer somewhere. Does it happen while the application is running or when exiting The reason why your app is working is more than likely you¡¯re initialising and cleaning up properly. All you need is to release an object but neglect to null it and all types of problems will happen if you¡¯re checking for a non-null pointer to use, even when cleaning up.





Re: Game Technologies: DirectX 101 Again - C++ DirectX Error

Key_46

the exception is triggered when i run the program ( after the first MsgProc call ) look at the Vertices tutorial for more info.
//
My program runs without errors BUT the Direct3DDevice9 memory becomes corrupted :

d3dpresentparameters:

ZeroMemory( &d3dpp, sizeof(d3dpp) );
d3dpp.hDeviceWindow = g_hWnd;
d3dpp.SwapEffect = D3DSWAPEFFECT_DISCARD;
d3dpp.BackBufferFormat = D3DFMT_A8R8G8B8;
d3dpp.EnableAutoDepthStencil = TRUE;
d3dpp.AutoDepthStencilFormat = D3DFMT_D16;
d3dpp.Windowed = TRUE;

the C++ Debugger - Watch of the Device ( after creation ) device.presentationParameters

BackBufferFormat - Unknown
BackBufferCount - 3476
SwapEffect - 8
MultisampleType - 1443264
MultisampleQuality - 8

and so on...

in fact, i only found this because the Mesh->DrawSubset() doesn't work....





Re: Game Technologies: DirectX 101 Again - C++ DirectX Error

Bad Habit

My version of the vertice¡¯s tutorial runs fine after I build it. I didn¡¯t get that output for the device¡¯s parameters. But we also have consider that my version of the SDK is more than likely a bit older than yours by a couple of years.

This is what I got:

BackBufferWidth - 292
BackBufferHeight - 273
BackBufferFormat - D3DFMT_A8R8G8B8
BackBufferCount - 1
MultiSampleType - D3DMULTISAMPLE_NONE
MultiSampleQuality - 0
SwapEffect - D3DSWAPEFFECT_DISCARD
Windowed - 1
EnableAutoDepthStencil - 1
AutoDepthStencilFormat - D3DFMT_D16
Flags - 1
FullScreen_RefreshRateInHz - 0
PresentationInterval - 0

Have you defined D3D_DEBUG_INFO so you can get some proper debug information





Re: Game Technologies: DirectX 101 Again - C++ DirectX Error

Key_46

yep, and the directX debug libraries are also included....




Re: Game Technologies: DirectX 101 Again - C++ DirectX Error

Bad Habit

You can try commenting out all the DX stuff so you have a bog standard window just to see if DefWindowProc() is throwing a fit because of some Win32 error, really just to eliminate that from the equation.





Re: Game Technologies: DirectX 101 Again - C++ DirectX Error

Key_46

eureka...ok...this ins't the answer but i am tooo close......ok....i removed the DX part and the MsgProc worked! And...i found why my App works and the DX Examples don't. Here it is:

the Tutorial do this in WinMain :

-Register Window
-Create Window
-Initialize the D3D
-Refresh Window
-Show Window

now...my App

-Register Window
-Create Window
-Refresh Window
-Show Window
-Initialize the D3D

//
if I refresh and show my window before create D3D the app run but, if I refresh and show my window AFTER the creation of D3D it hangs up!




Re: Game Technologies: DirectX 101 Again - C++ DirectX Error

Bad Habit

That¡¯s cool. DX needs a window up and showing so that it gets initialised properly so you should show the window first with ShowWindow() then update it with UpdateWindow(). Then you can do all the DX stuff.





Re: Game Technologies: DirectX 101 Again - C++ DirectX Error

Key_46

The only thing that doesn't make sense is why this "condition" appeared in the October2006 SDK and why the Examples are "wrong" maybe this problem is only with my computer....




Re: Game Technologies: DirectX 101 Again - C++ DirectX Error

Bad Habit

My samples are the same, after you mentioned the show and update I had a closer look, but they work. But I remember reading somewhere that the window has to be up and running, basically valid, for DX to properly initialise. Nothing wrong with your system, I would say that your system is quite quick and it was catching the error, which is good because if you create something for someone at least you know you won¡¯t be getting that rubbish if you initialise properly. You know, one of those hidden demons.

But anyway a least you don¡¯t have to worry about DX being corrupt, that¡¯s cool.