Hi everybody, I'm programming in Visual C++ 4.0 for Windows 95.
I'm trying to handle midi in inputs with a callback function namely :
void CALLBACK MidiInProc(HMIDIIN hmi,UINT wMsg,DWORD dwInstance,DWORD dwParam1,DWORD dwParam2)
And in order to open the Midi In Port I need a pointer to the callback function to use in the following function :
MMRESULT midiInOpen(LPHMIDIIN lphMidiIn, UINT uDeviceID,
DWORD dwCallback, DWORD dwCallbackInstance, DWORD dwFlags);
dwCallback is the pointer and must be casted to double word.
Here is the declaration of the damned pointer :
void (CALLBACK *pMI)(HMIDIIN,UINT,DWORD,DWORD,DWORD) = MidiInProc;
and here it's passed as parameter in the function which opens Midi In port :
But that works only when my callback function is a global function, and you can guess that I am not interested, I want it to be a class method.
So I put the callback function in a class, I declared my pointer so :
void (CALLBACK MyClass::*pMI)(HMIDIIN,UINT,DWORD,DWORD,
DWORD) = MidiInProc;
But it gives me the following error code :
error C2643: illegal cast from pointer to member
Please any suggestions about how to get it work fine ?
And I would like to use those callback functions, I know there are other ways, but I will change only if there 's no solution for my problem.