All pastes #388178 Raw Edit

Anonymous

public c v1 · immutable
·published 2007-03-09 21:51 UTC
rendered paste body
/*Well, I'll try to explain my problem in english.I'm dealing with the MFC, when your receive a message, you need to do a thing like this to intercept it :*/ON_COMMAND(IDC_ACTIONSCAN, &FunctionAdress) //that work cause it s the way to be do/*What I want is to put a variable instead of FunctionAdress which will contain a function adress, it will makemy programme possible to dynamicly change the adress of the function and use a different function.*/ON_COMMAND(IDC_ACTIONSCAN, reinterpret_cast<AFX_PMSG>(&a_variable))  //won't work impossible to cast//The same without macrp won't work too :ON_COMMAND(IDC_ACTIONSCAN, reinterpret_cast<void (AFX_MSG_CALL CWnd::*)(void)>(&a_variable)) /*The problem is that it don't work, impossible to cast a var of any type to a AFX_PMSG, even with a reinterpret_cast*/class myclass {//[...]	afx_msg static int a_variable;	//contain the adress of the function	afx_msg void OnMenuModuleMenuDefault();   //it work if I use this function//[...]}myclass::OnMenuModuleMenuDefault{ DoSomething() }myclass::a_variable = //adresse of a default function, will be changed if a dll is loaded or something else