Click here to Skip to main content
15,892,298 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Class function sets the hook for mouse events.
How to pass specific class instance pointer to callback function LRESULT CALLBACK MouseProc?
Thanks!
Posted

1 solution

As far as I know, you cannot do that, since there is no way to pass data to the MouseProc callback. However, you could export your class instance, using, for instance, a static method.
 
Share this answer
 
Comments
Igor-84 10-Sep-14 3:11am    
CPallini, can you write a small example which would help me to understand. Thanks!
CPallini 10-Sep-14 3:36am    
You may have a look at Singleton design pattern, for instance (you haven't to implement it, but your code would be very similar).
Igor-84 10-Sep-14 3:52am    
CPallini, I don't understand how it can help me...
CPallini 10-Sep-14 4:02am    
The callback can only access global variables or static methods. So these are your alternatives.
Igor-84 10-Sep-14 9:04am    
As far as I understand, a singleton pattern can work with only one instance of the class. And in my case there will be created a lot of copies. Can you give an example of code? Thanks!

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900