Link to home
Start Free TrialLog in
Avatar of Kani Str
Kani StrFlag for India

asked on

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.
Avatar of Mikal613
Mikal613
Flag of United States of America image

Avatar of Kani Str

ASKER

i visited this already, FYI

i am using, VS 2005, VB
Microsoft is working on one now. But there is no "Official" one now.
how this works out it Windows Mobile 5, can change my device if needed.
Avatar of checoo
checoo

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.
seems easy, would help me alot if you could convert this... thank you.
ASKER CERTIFIED SOLUTION
Avatar of checoo
checoo

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Excellent!