gpt4 book ai didi

c++ - EDSDK 消息循环在 Windows 8.1 下不工作

转载 作者:塔克拉玛干 更新时间:2023-11-03 08:03:12 25 4
gpt4 key购买 nike

我使用的是 Canon EDSDK_64 v2.15。我能够在 Windows7 下使用简单的消息循环接收 Canon SDK 发送的事件。例如,当我想拍照并等待我使用的图像数据时:

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);
};

这就是我注册对象处理程序的方式:

xCanonError = EdsSetObjectEventHandler(xCanonEOS, kEdsObjectEvent_All, CSDKHandleObjectEvent, this);
if (xCanonError != EDS_ERR_OK)
{
AddLogText(L"EdsSetObjectEventHandler() - error - "+GetCanonSDKError(xCanonError));
EdsRelease(xCanonEOS);
xCanonEOS = NULL;
EdsTerminateSDK();
return;
}

其中xCanonEOSEdsCameraRefthis 是一个指向类的指针,我用它来完成我的佳能相机的所有工作。这是我的对象事件处理函数:

    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;
}

我的问题是完全相同的代码在 Windows 8.1 下无法运行。程序只是进入 while 循环,注册的回调函数永远不会被调用。

我正在使用 VS2013 x64 编译器。我的相机是佳能 EOS 60D。我的应用程序正在使用 MFC 库。

有人可以指出我做错了什么或提供解决此问题的方法吗?

最佳答案

我有同样的问题,32 位版本解决了回调函数。

关于c++ - EDSDK 消息循环在 Windows 8.1 下不工作,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/28625226/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com