0

我正在尝试使源代码正常工作

extern "C" {
    typedef LRESULT (__stdcall *NRI_PM_CALLBACK)(WPARAM, LPARAM);
}

LRESULT OnPaymentManagerMessage(WPARAM wParam, LPARAM lParam)
{
    int type = (wParam >> 4) & 0x0F;
    int device = wParam & 0x0F;
    //cstr.Format("** Msg **[ %d %d %d ]", type, device, lParam);
    //handle message here
    return lParam;
}

NRI_PM_CALLBACK callback = &OnPaymentManagerMessage; //error on this line 

错误:“LRESULT (*)(WPARAM wParam, LPARAM lParam)”类型的值不能用于初始化“NRI_PM_CALLBACK”类型的实体

我在 Visual Studio Express 2012 中运行它

任何想法为什么?

谢谢

4

1 回答 1

3

OnPaymentManagerMessage()一个__stdcall函数:

LRESULT __stdcall OnPaymentManagerMessage(WPARAM wParam, LPARAM lParam) 
/* ... */

__cdecl是编译器的默认值(尽管编译器选项可以改变它)。

于 2013-02-28T08:35:49.657 回答