hmm.. odd shell crashes?
NeHe''s tutorial code seems to be crashing explorer, or any other program used to execute the suspect program. This causes problems, trying to debug and figure out what it is. I''m suspecting that it''s the while() message loop stuff, as I''ve written my own code unique Win32 code to handle my OpenGL applications. I use something like:
int a = 0;
.
.
.
while(a = 0)
{
PeekMessage(...)
TranslateMessage(...)
DispatchMessage(...)
RenderScene(...)
}
When the application is destroyed, I simply change the value of a to 1 to stop the loop. Is this code bad? It seems a lot simpler then nehe''s code, althow it doesnt support the "dont render while minimized" feature. It seems to work well. I''m not sure if it''s the message loop thats causing the crash or not. I suspect the loop thow, because the rest of my code is completely different then nehe''s. Anyone have any idea?
If you cut and pasted that straight out of your code the problem is your while() statement it should read:
Rather than:
while(a==0)
Rather than:
while(a=0)
This is my message loop. It's in Delphi, but Object Pascal is so similar to C that you should have no problem understanding it.
Steve 'Sly' Williams
Tools Developer
Krome Studios
Edited by - Sly on October 18, 2000 9:39:13 PM
procedure TSlyDXDraw.Run;var Msg: TMSG;begin FTerminated := False; { Loop while calling the application update and render functions and process any messages as they come in. } while not FTerminated do begin { Process all queued messages. } while PeekMessage(Msg, FWindowHandle, 0, 0, PM_REMOVE) do begin TranslateMessage(Msg); DispatchMessage(Msg); end; { Termination flag may have been set in processing of messages. } if not FTerminated then begin { Update. } if FActive and Assigned(FOnUpdate) then FOnUpdate(Self); { Render. } if FActive and Assigned(FOnRender) then FOnRender(Self); { Yield to other threads if required. } Sleep(0); end; end; Shutdown;end;
Steve 'Sly' Williams
Tools Developer
Krome Studios
Edited by - Sly on October 18, 2000 9:39:13 PM
I didn''t cut and past that code (hence the ...''s). The missing = was a typo.. Anyway, It''s not just my app that crashes, and it''s not all the time.. I can run an application all night long, however many times, with no problems. Then it dies out of nowhere when I try and close the application. Same thing happens with nehe''s source and executibles when I attempt to compile/execute his stuff.
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement