DirectX

Moderators: Sephiroth
Number of threads: 130
Number of posts: 207

This Forum Only
Post New Thread
Single Post View       Linear View       Threaded View      f

Report
[DX9] Unhandled Exception only when I declare a variable? Posted by Rune4234 on 31 Dec 2011 at 12:48 PM
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:
hResult = pd3dDevice->CreateOffscreenPlainSurface(width, height, D3DFMT_X8R8G8B8, D3DPOOL_DEFAULT, &surface, NULL);

However, up near the top of the program (line 26) I declare a variable for holding a font object:
LPD3DXFONT d3dFont;

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



 

Recent Jobs

Official Programmer's Heaven Blogs
Web Hosting | Browser and Social Games | Gadgets

Popular resources on Programmersheaven.com
Assembly | Basic | C | C# | C++ | Delphi | Flash | Java | JavaScript | Pascal | Perl | PHP | Python | Ruby | Visual Basic
© Copyright 2011 Programmersheaven.com - All rights reserved.
Reproduction in whole or in part, in any form or medium without express written permission is prohibited.
Violators of this policy may be subject to legal action. Please read our Terms Of Use and Privacy Statement for more information.
Operated by CommunityHeaven, a BootstrapLabs company.