I'm using Canon EDSDK_64 v2.15. I'm able to recieve events send by Canon SDK using simple message loop under Windows7. For example when I want to take a picture and waiting for image data I use:
xCanonError = EdsSendCommand(xCanonEOS, kEdsCameraCommand_TakePicture, 0);
if(xCanonError != EDS_ERR_OK)
{
AddLogText(L"sending command TakePicture - error - "+SmartCanon::GetCanonSDKError(xCanonError));
return false;
}
MSG msg;
while(eState == detector_state_busy)
{
if (::GetMessage(&msg, NULL, NULL, NULL) == -1)
{
AddLogText(L" - capture image - waiting for an image - GetMessage() error - " + std::to_wstring(HRESULT_FROM_WIN32(GetLastError())));
break;
}
else
{
TranslateMessage(&msg);
DispatchMessage(&msg);
}
Sleep(2);
};
That is how I register my object handler:
xCanonError = EdsSetObjectEventHandler(xCanonEOS, kEdsObjectEvent_All, CSDKHandleObjectEvent, this);
if (xCanonError != EDS_ERR_OK)
{
AddLogText(L"EdsSetObjectEventHandler() - error - "+GetCanonSDKError(xCanonError));
EdsRelease(xCanonEOS);
xCanonEOS = NULL;
EdsTerminateSDK();
return;
}
Where xCanonEOS
is EdsCameraRef
; this
is a pointer to a class which I use to do all the work with my Canon camera. And here is my object event handler function:
EdsError EDSCALLBACK CSDKHandleObjectEvent(EdsObjectEvent p_sCSDKEvent, EdsBaseRef p_sCSDKObject, EdsVoid* p_pCSDKData)
{
// my class for working with Canon camera
SmartCanon::TDetectorCANON* v_psDetectorCanonEOS = reinterpret_cast<SmartCanon::TDetectorCANON*>(p_pCSDKData);
// a lot of irrelevant code...
v_psDetectorCanonEOS->SetState(detector_state_idle);
return EDS_ERR_OK;
}
My problem is that the very same code do not work under Windows 8.1. Program just go into the while
loop and the registered callback function is never called.
I'm using VS2013 x64 compiler. My camera is Canon EOS 60D. My app is using MFC library.
Can someone can point out what I'm doing wrong or provide a solution how to fix this issue?