Unhandled Exception error with DirectX Program
CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 6 of 6

Thread: Unhandled Exception error with DirectX Program

  1. #1
    Join Date
    Mar 2010
    Posts
    3

    Exclamation Unhandled Exception error with DirectX Program

    Hi
    I'm trying to create a simple Direct X Application that displays a wireframe sphere. When I try to compile and run, I get the following error in a pop-up window:

    Unhandled exception at 0x00d71bae in KatieHanlonWeek3Lab.exe: 0xC0000005: Access violation reading location 0x00000000.

    I have no idea what it's about. I am doing this for a class assignment and we were given pieces of code to insert. The only error I can think of is me pasting them in the wrong place. The code in it's entirety is attached to this post in "Winmain.cpp". I have specified in the comments which pieces of code were pasted from the assignment.

    If anyone could help me out, that would be great. Thanks in advance.

    Katie
    Attached Files Attached Files

  2. #2
    Join Date
    Feb 2002
    Posts
    4,640

    Re: Unhandled Exception error with DirectX Program

    'pd3dDevice' is never initialized to a good value. It's NULL when you try to use it.

    Viggy

  3. #3
    Join Date
    Mar 2010
    Posts
    3

    Re: Unhandled Exception error with DirectX Program

    Okay those are the two lines of code that I figured were the problem because the program compiles and runs fine without them. So should I change the value of 'pd3dDevice'? If so, do you know how?

  4. #4
    Join Date
    Mar 2010
    Posts
    3

    Re: Unhandled Exception error with DirectX Program

    Quote Originally Posted by NintendoFreak91788 View Post
    Okay those are the two lines of code that I figured were the problem because the program compiles and runs fine without them. So should I change the value of 'pd3dDevice'? If so, do you know how?
    And by "compiling and running fine" I mean it works in it's original way, and not in the way I'm trying to modify it to work.

  5. #5
    Join Date
    Feb 2002
    Posts
    4,640

    Re: Unhandled Exception error with DirectX Program

    Unfortunately, no. I've never worked with DirectX.

    Viggy

  6. #6
    Join Date
    Apr 1999
    Posts
    3,585

    Re: Unhandled Exception error with DirectX Program

    pd3dDevice is a pointer to a DirectX device. It is established in the initDirect3D () function in your sample code. You should debug the code to determine why the create of the device is failing.
    Gort...Klaatu, Barada Nikto!

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  


Windows Mobile Development Center


Click Here to Expand Forum to Full Width

This is a CodeGuru survey question.


Featured


HTML5 Development Center