Problem with calling function pointer. My syntax seems a little rusty....

  • Thread starter Thread starter sbrothy
  • Start date Start date
S

sbrothy

Guest
I know this approach goes against all polymorphism and general OO techniques and benefits. I want to do it nontheless for message rerouting purposes though. So please bear with me.

I´m trying to override

BOOL CMainFrame::OnCmdMsg(UINT id, int code, void *pExtra, AFX_CMDHANDLERINFO* pHandler)


"Hidden" inside "pHandler" is sometimes a pointer to a function which I want to execute when my class is identified using RTTI.

So:


Code:
if (pane->IsKindOf(RUNTIME_CLASS(CClassView)) && pHandler)
{
TRACE("\tRTTI: [%s]\n", "CClassView");

void(CCmdTarget::*fp1)() = reinterpret_cast<void(CCmdTarget::*)()> (pHandler->pmf);


}

My function pointer knowledge is somewhat rusty, and nothing I try seems to work. Could anyone point me in the right direction now I seem to have the correct pointert set up I only need the correct syntax for calling it.


TIA,

Søren

Continue reading...
 
Back
Top