Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

CALLBACK function

Posted on 1999-06-30
3
Medium Priority
?
166 Views
Last Modified: 2010-04-02
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
Comment
Question by:alex1234
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
3 Comments
 
LVL 86

Accepted Solution

by:
jkr earned 200 total points
ID: 1198863
>>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
 
LVL 1

Author Comment

by:alex1234
ID: 1198864
That's too bad...
0
 
LVL 86

Expert Comment

by:jkr
ID: 1198865
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

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Article by: SunnyDark
This article's goal is to present you with an easy to use XML wrapper for C++ and also present some interesting techniques that you might use with MS C++. The reason I built this class is to ease the pain of using XML files with C++, since there is…
IntroductionThis article is the second in a three part article series on the Visual Studio 2008 Debugger.  It provides tips in setting and using breakpoints. If not familiar with this debugger, you can find a basic introduction in the EE article loc…
The goal of the video will be to teach the user the concept of local variables and scope. An example of a locally defined variable will be given as well as an explanation of what scope is in C++. The local variable and concept of scope will be relat…
The goal of the video will be to teach the user the difference and consequence of passing data by value vs passing data by reference in C++. An example of passing data by value as well as an example of passing data by reference will be be given. Bot…
Suggested Courses

722 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question