Jump to content

  • Log In with Google      Sign In   
  • Create Account


Windows multimedia timers and MFC


Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.

  • You cannot reply to this topic
2 replies to this topic

#1 drstrangeluv   Members   -  Reputation: 122

Like
Likes
Like

Posted 11 October 1999 - 12:26 PM

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?

Sponsor:

#2 Anonymous Poster_Anonymous Poster_*   Guests   -  Reputation:

Likes

Posted 11 October 1999 - 11:54 AM

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.

#3 Kentamanos   Members   -  Reputation: 122

Like
Likes
Like

Posted 11 October 1999 - 12:26 PM

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...

------------------

-Kentamanos





Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.



PARTNERS