Click here to Skip to main content
15,917,645 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralSDI Doc/View, synchronizing splitter windows w/ DirectX Pin
dtowers2312-Aug-05 19:32
dtowers2312-Aug-05 19:32 
GeneralUnion member cast and MFC message handling Pin
LiYS12-Aug-05 18:25
LiYS12-Aug-05 18:25 
GeneralRe: Union member cast and MFC message handling Pin
Jose Lamas Rios12-Aug-05 18:39
Jose Lamas Rios12-Aug-05 18:39 
GeneralRe: Union member cast and MFC message handling Pin
LiYS12-Aug-05 20:12
LiYS12-Aug-05 20:12 
GeneralRe: Union member cast and MFC message handling Pin
PJ Arends12-Aug-05 22:12
professionalPJ Arends12-Aug-05 22:12 
GeneralRe: Union member cast and MFC message handling Pin
LiYS12-Aug-05 23:58
LiYS12-Aug-05 23:58 
GeneralRe: Union member cast and MFC message handling Pin
Tim Smith13-Aug-05 5:02
Tim Smith13-Aug-05 5:02 
GeneralRe: Union member cast and MFC message handling Pin
PJ Arends13-Aug-05 6:51
professionalPJ Arends13-Aug-05 6:51 
YongSheng Li wrote:
Cast between two totally different function signature

But there is no actual cast involved. mmf.pfn is simply a generic function pointer that can hold a pointer to any function of any class derived from CCmdTarget, and the sig (AfxSig_is in this example) is used to keep track of what the function signature is so that when the function is called it is called with the exact same signature it was saved with. If you would go into the message map and change the sig from AfxSig_is to AfxSig_iis then you would be casting from one function signature to another (from int fnc(char*) to int fnc(int, char*)) and then you would get errors as this is not allowed.

The trick is that the function pointer is saved in the most generic format possible by downcasting it to a generic CCmdTarget function pointer. But it is upcast back to it's original format before it is used. In effect - no actual cast at all.




"You're obviously a superstar." - Christian Graus about me - 12 Feb '03

"Obviously ???  You're definitely a superstar!!!" - mYkel - 21 Jun '04

"There's not enough blatant self-congratulatory backslapping in the world today..." - HumblePie - 21 Jun '05

Within you lies the power for good - Use it!
GeneralIt seems that the MSComm can only transfer 40 bytes each time. Pin
pantao55112-Aug-05 17:37
pantao55112-Aug-05 17:37 
QuestionHow to get all zone in the DNS server? Pin
qtnl12-Aug-05 16:57
qtnl12-Aug-05 16:57 
Questionplease help me:build .c source file with VC++6,error LNK2001? Pin
fbzok12-Aug-05 16:50
fbzok12-Aug-05 16:50 
AnswerRe: please help me:build .c source file with VC++6,error LNK2001? Pin
Jose Lamas Rios12-Aug-05 18:32
Jose Lamas Rios12-Aug-05 18:32 
AnswerRe: please help me:build .c source file with VC++6,error LNK2001? Pin
sunit512-Aug-05 22:04
sunit512-Aug-05 22:04 
AnswerRe: please help me:build .c source file with VC++6,error LNK2001? Pin
fbzok12-Aug-05 22:08
fbzok12-Aug-05 22:08 
GeneralRe: please help me:build .c source file with VC++6,error LNK2001? Pin
Saurabh.Garg12-Aug-05 22:59
Saurabh.Garg12-Aug-05 22:59 
AnswerRe: please help me:build .c source file with VC++6,error LNK2001? Pin
fbzok12-Aug-05 23:18
fbzok12-Aug-05 23:18 
AnswerRe: please help me:build .c source file with VC++6,error LNK2001? Pin
fbzok13-Aug-05 4:30
fbzok13-Aug-05 4:30 
Generalrun single instance of app Pin
elephantstar12-Aug-05 12:17
elephantstar12-Aug-05 12:17 
GeneralWorking dir in Registry Pin
RickyC12-Aug-05 9:12
RickyC12-Aug-05 9:12 
GeneralRe: Working dir in Registry Pin
David Crow12-Aug-05 10:01
David Crow12-Aug-05 10:01 
GeneralRe: Working dir in Registry Pin
RickyC12-Aug-05 10:31
RickyC12-Aug-05 10:31 
General3rd party Menu Check State... Pin
Jumpin' Jeff12-Aug-05 8:31
Jumpin' Jeff12-Aug-05 8:31 
Generalbracket tournament ctrl Pin
picazo12-Aug-05 8:18
picazo12-Aug-05 8:18 
GeneralLooking for GIS knowledge Pin
prcarp12-Aug-05 8:04
prcarp12-Aug-05 8:04 
GeneralRe: Looking for GIS knowledge Pin
FlamTaps12-Aug-05 9:10
FlamTaps12-Aug-05 9:10 

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.