Original Post
Hey there, I'm porting an old C++ game to C# at the moment and I'm having an issue with the message loop. Here is my code:
As you can see I'm using the interop services to import WaitMessage(). I'm using that to suspend processing while the window is not in focus. Processing resumes once the window gets a GotFocus event (Or any other event for that matter). I'm betting that there is a better way to do this than importing a Win32 function. I was using Thread.Sleep() before and that worked but still left the program using up some CPU time. Are there any other alternatives?
|