回掉函数小例子,这里做备忘
dll代码
typedef int (*CallBackType)(int a, int b); CallBackType m_CallBackType; int WINAPI MFCCallBackDllTest(int a, int b) { int result = m_CallBackType(a, b); return result; } int WINAPI SetCallBackFun(CallBackType inCallBackType) { m_CallBackType = inCallBackType; return 0; }
|
调用方代码
int myTestFun(int a, int b) { return a - b; } void CMFCCallBackDemoDlg::OnBnClickedButton1() { SetCallBackFun(myTestFun); int result = MFCCallBackDllTest(3,4); }
|
这里是代码地址http://download.csdn.net/detail/wisdomfriend/9054363