Click here to Skip to main content
15,914,016 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: using typedef on class function pointer ? Pin
not_happy023-Oct-03 21:26
not_happy023-Oct-03 21:26 
AnswerRe: using typedef on class function pointer ? Pin
Iain Clarke, Warrior Programmer24-Oct-03 3:43
Iain Clarke, Warrior Programmer24-Oct-03 3:43 
GeneralRe: using typedef on class function pointer ? Pin
Michael Dunn24-Oct-03 12:33
sitebuilderMichael Dunn24-Oct-03 12:33 
GeneralRe: using typedef on class function pointer ? Pin
Iain Clarke, Warrior Programmer26-Oct-03 0:16
Iain Clarke, Warrior Programmer26-Oct-03 0:16 
GeneralRe: using typedef on class function pointer ? Pin
Iain Clarke, Warrior Programmer26-Oct-03 0:32
Iain Clarke, Warrior Programmer26-Oct-03 0:32 
GeneralRe: using typedef on class function pointer ? Pin
Mike O'Neill24-Oct-03 14:12
Mike O'Neill24-Oct-03 14:12 
GeneralRe: using typedef on class function pointer ? Pin
Iain Clarke, Warrior Programmer26-Oct-03 0:13
Iain Clarke, Warrior Programmer26-Oct-03 0:13 
GeneralRe: using typedef on class function pointer ? Pin
Mike O'Neill26-Oct-03 11:32
Mike O'Neill26-Oct-03 11:32 
I don't intend to appear stubborn, but when discussing the code you're referring to, the FAQ very clearly says it's "a patch". It's meant to be used in situations where you need to supply a plain-C callback function to the API, like in EnumChildWindows() or others.

In fact, the FAQ istelf poses the question as follows: "How do I pass a pointer-to-member-function to a signal handler, X event callback, system call that starts a thread/task, etc?" It's answer is a very direct one: "Don't"

Here's the precise link: http://www.parashift.com/c++-faq-lite/pointers-to-members.html#faq-33.2[^]

The issue with plain-C callback functions and the inability to (directly) use C++ member functions is well-described at MSDN in "Calling All Members: Member Functions as Callbacks" at http://msdn.microsoft.com/archive/default.asp?url=/archive/en-us/dnarvc/html/msdn_callb.asp[^] I agree that the technique is a good one for the situation described in the FAQ.

But it's not correct to say that you can't store (and use) a pointer to member functions.

It's also not correct to say that member functions can't be used in ways very similar to regular callbacks. Here's one example from MSDN, entitled "Pointers to Member Functions and Templates" at http://msdn.microsoft.com/archive/default.asp?url=/archive/en-us/dnarvc/html/msdn_callb.asp[^]

So, maybe the jury's still out .... Wink | ;)

Regards,
Mike
GeneralRe: using typedef on class function pointer ? Pin
Iain Clarke, Warrior Programmer26-Oct-03 22:39
Iain Clarke, Warrior Programmer26-Oct-03 22:39 
AnswerRe: using typedef on class function pointer ? Pin
Michael Dunn24-Oct-03 12:35
sitebuilderMichael Dunn24-Oct-03 12:35 
GeneralRe: using typedef on class function pointer ? Pin
not_happy028-Oct-03 14:20
not_happy028-Oct-03 14:20 
Generalunocows.lib Pin
nikoladsp23-Oct-03 19:10
nikoladsp23-Oct-03 19:10 
GeneralRe: unocows.lib Pin
Shog923-Oct-03 19:51
sitebuilderShog923-Oct-03 19:51 
GeneralMSChart question Pin
nikoladsp23-Oct-03 19:07
nikoladsp23-Oct-03 19:07 
GeneralAnother registry question Pin
dafunkt23-Oct-03 18:42
dafunkt23-Oct-03 18:42 
GeneralRe: Another registry question Pin
Michael Dunn23-Oct-03 19:04
sitebuilderMichael Dunn23-Oct-03 19:04 
GeneralRe: Another registry question Pin
David Crow24-Oct-03 3:04
David Crow24-Oct-03 3:04 
GeneralRe: Another registry question Pin
Alexander M.,24-Oct-03 10:03
Alexander M.,24-Oct-03 10:03 
GeneralRe: Another registry question Pin
Atlantys24-Oct-03 11:10
Atlantys24-Oct-03 11:10 
QuestionPls help. How to get the application icon of any application? Pin
Chau Nguyen23-Oct-03 17:47
Chau Nguyen23-Oct-03 17:47 
AnswerRe: Pls help. How to get the application icon of any application? Pin
Iain Clarke, Warrior Programmer24-Oct-03 4:46
Iain Clarke, Warrior Programmer24-Oct-03 4:46 
GeneralRe: Pls help. How to get the application icon of any application? Pin
Chau Nguyen29-Oct-03 19:18
Chau Nguyen29-Oct-03 19:18 
AnswerRe: Pls help. How to get the application icon of any application? Pin
Gary R. Wheeler25-Oct-03 4:46
Gary R. Wheeler25-Oct-03 4:46 
GeneralRe: Pls help. How to get the application icon of any application? Pin
Chau Nguyen29-Oct-03 19:15
Chau Nguyen29-Oct-03 19:15 
QuestionMFC custom control - custom message offset? Pin
mindows23-Oct-03 17:06
mindows23-Oct-03 17:06 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.