Sign in to follow this  
TriML

Game Loop in MFC

Recommended Posts

I have a D3D activex control using MFC and currently using OnIdle for update. As it seems not the good aproach, so what will be the best option to implement a game loop in this case? I came across this article, Continuous Updating in MFC is it sufficient for the purpose or there's more? Please elaborate in detail. Thanks.

Share this post


Link to post
Share on other sites
Hmmm. I've just taken a look, and I don't think it's possible. Thing is, when I wrote that article, I was targeting MFC Win32 applications. You can override CWinApp::Run just fine, but that's because CWinApp is derived from CWinThread (ie. it gets called every cycle). The COleControl class, on the other hand, isn't derived from CWinThread, it's derived from CWnd. That means you can't use the technique in my article there because CWnd is completely event-driven. To put it another way, any program which uses your ActiveX control would have to specifically update it every cycle. And I don't think you can do that with an ActiveX control. I think they're event-driven, so you'll have to stick with the OnIdle messages. I could be wrong, though; I've never written an MFC ActiveX control doing what you're doing.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this