我想将本机相机应用程序嵌入自定义形式。
我要在其中嵌入相机的RECT r属性如下:
r.top = 26;
r.bottom = 220;
r.left = 0;
r.right = 320;
这是运行本机摄像头应用程序的方法:
//Set the SHCAMERACAPTURE structure
ZeroMemory(&shcc, sizeof(shcc));
shcc.cbSize = sizeof(shcc);
shcc.hwndOwner = hwndOwner;
shcc.pszInitialDir = _T("\\My Documents");
shcc.pszDefaultFileName = _T("test.jpg");
shcc.pszTitle = _T("Camera Demo");
shcc.StillQuality = CAMERACAPTURE_STILLQUALITY_HIGH;
shcc.VideoTypes = CAMERACAPTURE_VIDEOTYPE_MESSAGING;
shcc.nResolutionWidth = 1024;
shcc.nResolutionHeight = 768;
shcc.nVideoTimeLimit = 15;
shcc.Mode = CAMERACAPTURE_MODE_STILL;
//display the camera capture dialog
hResult = SHCameraCapture(&shcc);
if(hResult == S_OK)
{
//TODO:: Write to log
}
return hResult;
}
从窗口调用尺寸等于r的上述方法:
HRESULT hr = S_OK;
hr = m_PhotoCapture.CameraCapture(this->m_hWnd, L"test");
有谁知道如何修改上述函数(hwndOwner)以在矩形r中显示嵌入式资源的方式?
最佳答案
您对hwndOwner指向的内容不太清楚。我对这可能如何工作的猜测是,您需要创建一个Window,该Window是您的主显示Window的子窗口,其位置与您的rect相匹配(并且可见),然后将其传递进来,然后Capture API使用DShow将通过摄像头抓取的帧的输出通过管道传递到手柄代表的那个Window。