Results 1 to 4 of 4

Thread: Access Violation error

  1. #1

    Thread Starter
    New Member
    Join Date
    May 2002
    Posts
    6

    Access Violation error

    Ok this time I'm using Borland C++ Builder and I got a small app to compile and link just fine but I get an access violation error when it is running. It happens when I call the DirectX function "IDirect3DDevice8::Clear" in my "Render()" function (See file below). Anyone know what's going wrong here?

  2. #2
    Kitten CornedBee's Avatar
    Join Date
    Aug 2001
    Location
    In a microchip!
    Posts
    11,594
    Most likely you write to memory you don't own. I haven't looked at the code, but that's the most probable error.
    All the buzzt
    CornedBee

    "Writing specifications is like writing a novel. Writing code is like writing poetry."
    - Anonymous, published by Raymond Chen

    Don't PM me with your problems, I scan most of the forums daily. If you do PM me, I will not answer your question.

  3. #3
    Zaei
    Guest
    This is an easy one =). Dont Render() when you get a WM_PAINT. Your problem is that when you call ShowWindow(), you havent initialized DX yet, and your Window Proc gets a WM_PAINT message, which calls Render(), and causes your error (Your D3D Device is invalid).

    Never call Render() in this way. Instead, call it in a loop in your main program, each time you process messages. It should look something like this:
    Code:
    while(running)
    {
      if(PeekMessage(hWnd, &msg, 0, 0, PM_REMOVE))
      {
         TranslateMessage(...);
         DispatchMessage(...);
       }
       Render();
    }
    Z.

  4. #4

    Thread Starter
    New Member
    Join Date
    May 2002
    Posts
    6
    Thanks a bunch! It works fine now .

Posting Permissions

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



Click Here to Expand Forum to Full Width