0

I am trying to make a source code to work

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 

Error:a value of type "LRESULT (*)(WPARAM wParam, LPARAM lParam)" cannot be used to initialized an entity of type "NRI_PM_CALLBACK"

I am running this in Visual Studio Express 2012

Any ideas why ?

Thanks

0

1 Answer 1

3

Make OnPaymentManagerMessage() a __stdcall function:

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

__cdecl is the default for the compiler (though a compiler option can change that).

Sign up to request clarification or add additional context in comments.

2 Comments

And extern "C" (although I think VC++ ignores this in favor of its proprietary extensions).
Thank you Michael, I love you :D

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.