mfc threads and stdcall function
I am trying to convert a Win32 program using threads to MFC, but I am
having trouble with a library I am using that uses __stdcall in its
function definition. How do I get this to work in MFC? Everytime I try
to compile I get this error:
Z.K.
////////////////////////////////////////////////////////////////////
error C2664: 'CPhidgetInterfaceKit_set_OnSensorChange_Handler' : cannot
convert parameter 2 from 'int (long,void *,int,int)' to 'int (__stdcall
*)(long,void *,in
t,int)'
None of the functions with this name in scope match the target type
//////////////////////////////////////////////////////////////////////
//from phidget20.h
int __stdcall CPhidgetInterfaceKit_set_OnSensorChange_Handler
(CPhidgetInterfaceKitHandle, int (__stdcall * fptr)
(CPhidgetInterfaceKitHandle, void *, int, int), void *);
int __stdcall IFK_SensorChangeHandler(CPhidgetInterfaceKitHandle IFK,
void *userptr, int Index, int Value)
{
printf("Sensor %d is %d \n", Index, Value);
return 0;
}
int CThread2Dlg::test_InterfaceKit()
{
HANDLE m_ThreadHandle;
unsigned long m_sThreadIdentifier;
int result = 0;
CPhidgetInterfaceKitHandle IFK = 0;
CPhidgetInterfaceKit_create(&IFK);
result = CPhidget_open(IFK, -1);
if (result)
{
printf ("No InterfaceKit found...\n");
return 0;
}
CPhidgetInterfaceKit_set_OnSensorChange_Handler(IFK,
IFK_SensorChangeHandler, NULL);
return 0;
}