🎉 Celebrating 25 Years of GameDev.net! 🎉

Not many can claim 25 years on the Internet! Join us in celebrating this milestone. Learn more about our history, and thank you for being a part of our community!

VB DoEvents method in C++

Started by
1 comment, last by Khoals 22 years, 10 months ago
Ok, this is a real newbie question, but I''m not sure about it: In Visual Basic, there is a method called DoEvents that let''s Windows handle any incoming messages from other programs/hardware and still maintain control of your program. This is useful in infinite loops (like a game loop or something) where you don''t want the loop to end and still don''t want the system to crash because all of the resources are going towards performing the loop. My question is how do I do anything that works like DoEvents in C++. Do infinite loops even lock up the system in C++? Thanks in advance.
Advertisement
No, infinite loops don''t kill a C/C++ program. Of course, there''s no REAL infinite loop, what''d be the point? See winprog.org for some more information on basic windows programs in C/C++.

[Resist Windows XP''s Invasive Production Activation Technology!]
  bool Terminated = false;void DoEvents(){    MSG msg;    while(PeekMessage(&msg, NULL, 0, 0, PM_REMOVE))    {        if(msg.message == WM_QUIT)        {            Terminated = true;            return;        }        TranslateMessage(&msg);        DispatchMessage(&msg);    }}  

This topic is closed to new replies.

Advertisement