Message Loops and PeekMessage

Started by
12 comments, last by bazee 21 years, 7 months ago
Thankyou! DerekSaw your solution works perfectly

My application is both windowed and fullscreen, you can switch between them at run time by pressing a key (later on I will put this function on an options screen or something).

Machaira, I felt the need to do this for several reasons.

- Curiosity. I''m learning lots. Also, when I move onto C++ this will also be essential knowledge.

- Control. My own window object can do alot more than a VB form can.

- Performance. I''m not sure if there will be much of a performance increase, but I won''t know unless I try.

- Lean-ness (I need a better word, lol). VB Forms do alot of things which I don''t need for a simple DX window.

There remain a few unanswered questions, but I think I can figure them myself from here.

How comes the application freezes up without this extra code? I''m assuming its just because it falls into a very tight loop.

How do I go about creating an application with multiple windows? I guess I must only stop processing if all windows are inactive.

And what if my application has no windows at all? How do I know when I''m inactive then? I guess I will have to voluntarily become inactive every so often to avoid hogging CPU.

See, a stupid VB programmer is becoming more enlightened
Advertisement
Testing the performance, the FPS seems to have have gone from 68 to 90 FPS, consistently and this is for code that does exactly the same thing (I''m only commenting out 1 line of code for another to switch between VB forms and my own windows, both implementations are using the same interface). So I guess it really was worth my (and everyone who answered to my post)''s trouble.
That''s great! ... now I''m waiting for one fast VB game.
.... err.... Actually, what are you doing?
"after many years of singularity, i'm still searching on the event horizon"
I''m making an online multiplayer RPG. So far I''ve got multiple players running around a randomly generated 3D landscape. But, thats all so far... no building, fighting, magic etc. Ofcourse, I plan to put this all in eventually. While I''m waiting for further design docs I have been refining the engine. Until now it had used a VB form. I''m using quadtrees together with dynamic level of detail to make the game fast... but then I figured just improving the basic message loop would be far more worthwhile, since it only took a day and gave a huge benefit. It took me ages to do the other stuff (well, 8 months). As soon as I get time, I''ll put up a website about the game.

This topic is closed to new replies.

Advertisement