I want to embed the native camera application into custom form. The RECT r properties where I want to embed the camera are the following:
r.top = 26; r.bottom = 220; r.left = 0; r.right = 320;
and this is the method which runs the native camera application:
HRESULT CPhotoCapture::CameraCapture(HWND hwndOwner, LPTSTR pszFilename) { HRESULT hResult; SHCAMERACAPTURE shcc;
//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;
}
The method above is called from the window which dimensions are equal to r:
HRESULT hr = S_OK; hr = m_PhotoCapture.CameraCapture(this->m_hWnd, L'test');
Does anyone know how to modify the above function (hwndOwner) the way to display the embedded resource in the rectangle r?
You’re not too clear on what hwndOwner points to. My **guess* on how this probably works is that you need to create a Window that is a child of your main display Window whose location matches your rect (and is visible), then pass it’s handle in and that the capture API then uses DShow to pipe the output of the frame grabs from the camera to that Window that the handle represents.