[Webinar] Streamline your web hosting managementRegister Today

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 171
  • Last Modified:

CALLBACK function

Is it possible to have a function in a class that calls DialogBoxIndirect() and passes to it DialogProc() function which is a non-static member of the same class?
0
alex1234
Asked:
alex1234
  • 2
1 Solution
 
jkrCommented:
>>which is a non-static member of the same class?

In short words - no.

A class' member function can only be a callback when it's declared 'static'. All C++ member functions are passed a 'this' pointer as a hidden argument to maintain the method/object relation. The only way to get around this is declaring the member as 'static', so no 'this' pointer is used (and the parameter list matchs the one of a callback funcfion).
0
 
alex1234Author Commented:
That's too bad...
0
 
jkrCommented:
Yes, it is - BTW: If you want to know more about how to handle C++ method pointers (err, they aren't real pointers, but indices into '_vtbl'), see 'http://www.codeguru.com/win32/dyndllclass.shtml'
0

Featured Post

Keep up with what's happening at Experts Exchange!

Sign up to receive Decoded, a new monthly digest with product updates, feature release info, continuing education opportunities, and more.

  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now