[DX9] Unhandled Exception only when I declare a variable? - Programmers Heaven

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!


Welcome to the new platform of Programmer's Heaven! We apologize for the inconvenience caused, if you visited us from a broken link of the previous version. The main reason to move to a new platform is to provide more effective and collaborative experience to you all. Please feel free to experience the new platform and use its exciting features. Contact us for any issue that you need to get clarified. We are more than happy to help you.

[DX9] Unhandled Exception only when I declare a variable?

Rune4234Rune4234 Posts: 1Member
This program compiles just fine, but when it runs it throws this error: Unhandled exception at 0x011627d6 in dx1.exe: 0xC0000005: Access violation reading location 0x00000030.

When I go into debugging, it says the problem is with line 313: [code]hResult = pd3dDevice->CreateOffscreenPlainSurface(width, height, D3DFMT_X8R8G8B8, D3DPOOL_DEFAULT, &surface, NULL);[/code]
However, up near the top of the program (line 26) I declare a variable for holding a font object:
[code]LPD3DXFONT d3dFont;[/code]
If you comment out that line then the program suddenly works. I have commented out all the code that uses the font object, so I am fairly certain that this is the problem.

Anyone have any ideas? All help is GREATLY appreciated. Been searching for hours to no avail. I am using Visual Studio 2010 in case that's relevant.

Full code: http://pastebin.ca/2097898
Sign In or Register to comment.