how to activate camera

I have an application that need to activate the camera and let the user save the photo, i am not sure how to do this, don't know what API does this.... please help.
LVL 12
Who is Participating?
checooConnect With a Mentor Commented:
Hope this helps --

Private Sub photoMenuItem_Click(ByVal sender As Object, ByVal e As EventArgs)
 Dim cameraCaptureDialog As CameraCaptureDialog = New CameraCaptureDialog
 cameraCaptureDialog.Owner = Me
 cameraCaptureDialog.Title = "Take Exhibit Photo"
 cameraCaptureDialog.Mode = CameraCaptureMode.Still
 If cameraCaptureDialog.ShowDialog = DialogResult.OK AndAlso cameraCaptureDialog.FileName.Length > 0 Then
   fileExtension = Path.GetExtension(cameraCaptureDialog.FileName)
   File.Copy(cameraCaptureDialog.FileName, fileName)
   pictureBox.Image = New Bitmap(fileName)
 End If
End Sub
str_kaniAuthor Commented:
i visited this already, FYI

i am using, VS 2005, VB
Keep up with what's happening at Experts Exchange!

Sign up to receive Decoded, a new monthly digest with product updates, feature release info, continuing education opportunities, and more.

Microsoft is working on one now. But there is no "Official" one now.
str_kaniAuthor Commented:
how this works out it Windows Mobile 5, can change my device if needed.
With the Windows Mobile 5.0 software a generic camera API is now defined that device manufacturers support. The .NET Compact Framework, Windows Mobile 5.0 software includes a ready-made dialog named CameraCaptureDialog available in , and you can find it in the "Microsoft.WindowsMobile.Forms".

An indicative sample code is given below

private void photoMenuItem_Click(object sender, EventArgs e)
  CameraCaptureDialog cameraCaptureDialog = new CameraCaptureDialog();
  cameraCaptureDialog.Owner = this;
  cameraCaptureDialog.Title = "Take Exhibit Photo";
  cameraCaptureDialog.Mode = CameraCaptureMode.Still;
  if(cameraCaptureDialog.ShowDialog() == DialogResult.OK &&
    cameraCaptureDialog.FileName.Length > 0)
    fileExtension = Path.GetExtension(cameraCaptureDialog.FileName);
    File.Copy(cameraCaptureDialog.FileName, fileName());
    pictureBox.Image = new Bitmap(fileName());

The above is a C# code but can be converted fairly easily to VB.NET. Let me know if you need any help.
str_kaniAuthor Commented:
seems easy, would help me alot if you could convert this... thank you.
str_kaniAuthor Commented:
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.