zjc36
12-05-2006, 06:00 AM
I want to get a still picture by using SHCameraCapture(). But it return E_FAIL. Our OS is Windows Mobile 5.0
HRESULT CameraCaptureExample(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 = TEXT("\\My Documents");
shcc.pszDefaultFileName = TEXT("test.jpg");
shcc.pszTitle = TEXT("Camera Demo");
shcc.VideoTypes = CAMERACAPTURE_VIDEOTYPE_ALL;
shcc.nResolutionWidth = 176;
shcc.nResolutionHeight = 144;
shcc.nVideoTimeLimit = 15;
shcc.Mode = CAMERACAPTURE_MODE_STILL;
// Display the Camera Capture dialog.
hResult = SHCameraCapture(&shcc);
// The next statements will execute only after the user takes
// a picture or video, or closes the Camera Capture dialog.
if (S_OK == hResult)
{
StringCchCopy(pszFilename, MAX_PATH, shcc.szFile);
}
return hResult;
}
HRESULT CameraCaptureExample(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 = TEXT("\\My Documents");
shcc.pszDefaultFileName = TEXT("test.jpg");
shcc.pszTitle = TEXT("Camera Demo");
shcc.VideoTypes = CAMERACAPTURE_VIDEOTYPE_ALL;
shcc.nResolutionWidth = 176;
shcc.nResolutionHeight = 144;
shcc.nVideoTimeLimit = 15;
shcc.Mode = CAMERACAPTURE_MODE_STILL;
// Display the Camera Capture dialog.
hResult = SHCameraCapture(&shcc);
// The next statements will execute only after the user takes
// a picture or video, or closes the Camera Capture dialog.
if (S_OK == hResult)
{
StringCchCopy(pszFilename, MAX_PATH, shcc.szFile);
}
return hResult;
}