Programmatically capture images with Camera application

While developing an application I found that following methods can be used to launch the Camera capture application.

I have seen the following code work on WM 5.0 device:

SHELLEXECUTEINFO ExecInfo = {0};
ExecInfo.cbSize = sizeof(SHELLEXECUTEINFO);
ExecInfo.lpFile = L”\\windows\\pimg.exe”;
ExecInfo.lpParameters = L”-camerakey”;
ExecInfo.lpVerb = L”open”;
ShellExecuteEx(&ExecInfo);

And following code on WM 6.0 device:

void ShowCameraCapture()
{

SHCAMERACAPTURE shcc;

// Set the SHCAMERACAPTURE structure.
ZeroMemory(&shcc, sizeof(shcc));
shcc.cbSize = sizeof(shcc);
shcc.hwndOwner = hwndOwner;
shcc.pszInitialDir = NULL;
shcc.pszDefaultFileName = NULL;
shcc.pszTitle = TEXT(“PK Camera”);
shcc.VideoTypes = CAMERACAPTURE_VIDEOTYPE_ALL;
shcc.nResolutionWidth = 0;
shcc.nResolutionHeight = 0;
shcc.nVideoTimeLimit = 0;
shcc.Mode = CAMERACAPTURE_MODE_STILL;

// Launch the Camera Capture screen
SHCameraCapture(&shcc);

}

You can fillup the fields of SHCAMERACAPTURE structure for controlling many aspects of camera operations. Look into MSDN for details.

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: