|
-
May 31st, 2002, 12:01 PM
#1
Thread Starter
New Member
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?
-
May 31st, 2002, 03:26 PM
#2
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.
-
May 31st, 2002, 03:32 PM
#3
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.
-
May 31st, 2002, 04:27 PM
#4
Thread Starter
New Member
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
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|