How do I move / resize a resource on the screen?

I want to embed my own camera app in a custom form. The RECT r properties in which I want to embed the camera are as follows:

r.top = 26; r.bottom = 220; r.left = 0; r.right = 320;

and this is the method that launches the native camera app:

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 above method is called from a window whose dimensions are r:

HRESULT hr = S_OK;
hr = m_PhotoCapture.CameraCapture(this->m_hWnd, L"test");

      

Does anyone know how to change the above function (hwndOwner) to display the inline resource in rectangle r?

+1


source to share


2 answers


You are not very clear about what hwndOwner is pointing to. My guess * of how this probably works is that you need to create a window that is a child of your main window. A window whose location matches your rectangle (and is visible), then pass it a handle and then the DShow capture API to output the frame output captures from the camera to that window, which the handle represents.



0


source


I think you need to put a box of pictures (sized to the required dimensions) in your custom form, and then pass the handle to the window of the picture window instead of the handle to the form itself.



+1


source







All Articles