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

C / C++ / MFC

 
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 
GeneralRe: using typedef on class function pointer ? Pin
Iain Clarke, Warrior Programmer26-Oct-03 22:39
Iain Clarke, Warrior Programmer26-Oct-03 22:39 
After Mike Dunns FAQ posting, I posted a mini-retractment. In a general windows callback (ie for
CreateThread etc) you have to use a static function. You can cast its void * parameter to the object
in question and call a "normal" member function, getting around the issue.

The mdsn_callb.asp page you pointed to also spells this out. It does include a lookup method which
may well work in circumstances. But it is still using a static as the callback, which then derives
an opbject pointer before calling the member function.

Mike Dunn did point out how to create a pointer to class member function pointer which was a new one
to me. This is a new one on me, and I can see it being very useful. But you now need to store two
pointers. Which object, and which member of that object! You can get around it, but not without non-
trivial bookkeeping. So I would consider it too much hard work, and too prone to mistakes for use as
a windows callback function.

So, to misquote myself:
"... You can't. But you can cheat, and get around the problem!".

In my experience, there's never a hard and fast CAN'T. But there is a "way too much like hard work when
much easier, simpler and safer ways exist". Unsure | :~

In next weeks episode, "How many angels can line-dance on the side of a pin".

Iain.

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 
AnswerRe: MFC custom control - custom message offset? Pin
Michael Dunn23-Oct-03 19:06
sitebuilderMichael Dunn23-Oct-03 19: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.