Why I can't pass to WNDCLASS callback function but can if it static 
Author Message
 Why I can't pass to WNDCLASS callback function but can if it static

This behavior is by design. A member function used as a callback function
must be static. A non-static member function cannot be used as a callback
function. You can also use file scope global functions for callback
functions.

In C++ every member function has a hidden parameter known as the "this"
pointer. C++ is able to associate a function with a particular instance of
an object by means of the "this" pointer. Therefore, if a callback
function, defined as a non-static member function, is called, it will
expect a particular instance of an object.

-Allen

Disclaimer:
This posting is provided "AS IS" with no warranties, and confers no rights.



Sat, 10 Jul 2004 15:22:26 GMT  
 
 [ 1 post ] 

 Relevant Pages 

1. Determining what canned preprocessor symbols are available

2. Beginner [Q] Using Canned File Open/Save dialog

3. Help with compiling a "canned" program

4. Canned Dialogs

5. Passing "callback" function to a function

6. Getting pointer to non-static member function from C callback function

7. Passing C++ Class Member Function to as a C Callback Function Parameter

8. Using Non-Static Callback Functions as member Functions VC5.0

9. Does C have a "canned" find function?

10. Can you pass a method as a callback function

11. CALLBACK and non-static member function problem!

12. Using Non-Static Callbacks as member functions VC 5.0

 

 
Powered by phpBB® Forum Software