Jump to content
  • Advertisement


This topic is now archived and is closed to further replies.


Windows multimedia timers and MFC

This topic is 6918 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Guest Anonymous Poster
I had this problem too. As far as I know, you can't pass a class member function as a callback param. I might be wrong, I don't know, u better make sure, but here's the way I solved it.
I made the member function of a class a friend function, so it wouldn't be a member anymore, but would be able to get to private or protected data, and then passed it as a callback.

Share this post

Link to post
Share on other sites
The problem here is the implied this pointer as the first argument to any class method. If you declare it as a static method, then you won't have the problem getting the signatures to line up.

The problem is then that you need a this pointer to be able to access the non static methods and data in the class. That's why callback type functions usually have a "user data" type parameter. Notice the dwUser argument in this particular function. This is where you pass your this pointer and you cast it in your static function to access other methods and members.

Check out this post: http://www.gamedev.net/community/forums/ubb/Forum6/HTML/000170.html
It's actually a very similar situation.

Email me if you need more help...



Share this post

Link to post
Share on other sites
I'm having some trouble getting the timeSetEvent to accept a method of a class as the callback parameter, even though I've declared the method as specified in Microsoft's multimedia timer overview (using the CALLBACK keyword). Could someone give me some help with this?

Share this post

Link to post
Share on other sites

  • Advertisement

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!