locked
Camera Application in my Smart Device Application RRS feed

  • Question

  • My device using Windows Mobile 6.1. Currently, I saw there was camera application in my OS. It was Under Programs -> Picture & Video -> Camera

    Once Im open Camera, I can take picture from my device.

    My question is, how to make it this camera application in my Smart Device Project? As a result, I can open my Smart Device Project then take picture from that.

    Need advice

    Thursday, July 15, 2010 6:08 PM

Answers

  • You can use the CameraCaptureDialog.  Just add a reference to Microsoft.WindowsMobile.Forms, and then do something like this:

    CameraCaptureDialog ccd = new CameraCaptureDialog();
    ccd.ShowDialog();
    MessageBox.Show(ccd.FileName);
    

    This example will show the CameraCaptureDialog, and allow the user to take a picture.  Once the dialog is dismissed, it will display the path to the picture that was taken.  There are a lot of settings that you can tweak before you call ShowDialog, such as Mode, Title, and Resolution.

    • Edited by nispio Thursday, July 15, 2010 6:32 PM fixed code formatting
    • Marked as answer by Bonusnet Friday, July 16, 2010 3:00 AM
    Thursday, July 15, 2010 6:29 PM

All replies

  • You can use the CameraCaptureDialog.  Just add a reference to Microsoft.WindowsMobile.Forms, and then do something like this:

    CameraCaptureDialog ccd = new CameraCaptureDialog();
    ccd.ShowDialog();
    MessageBox.Show(ccd.FileName);
    

    This example will show the CameraCaptureDialog, and allow the user to take a picture.  Once the dialog is dismissed, it will display the path to the picture that was taken.  There are a lot of settings that you can tweak before you call ShowDialog, such as Mode, Title, and Resolution.

    • Edited by nispio Thursday, July 15, 2010 6:32 PM fixed code formatting
    • Marked as answer by Bonusnet Friday, July 16, 2010 3:00 AM
    Thursday, July 15, 2010 6:29 PM
  • Hi

    First add the NameSpace as:-  Microsoft.WindowsMobile.Forms

    And writhe below code in a button Click event

     

    CameraCaptureDialog cameraCapture = new CameraCaptureDialog();
    cameraCapture.Owner = this;
    cameraCapture.InitialDirectory = @"\My Documents\My Pictures";
     cameraCapture.DefaultFileName = @"test2";
    cameraCapture.DefaultFileName = cameraCapture.DefaultFileName + cecameraDefaultPictureExtension;
            
        try
        {
                    
            if (DialogResult.OK == cameraCapture.ShowDialog())
            {
                      string fileName = cameraCapture.FileName;        

           
                      MessageBox.Show("The picture has been successfully captured ");

                      Bitmap bmp = new Bitmap(cameraCapture.FileName);

                      
                      pictureBox1.Image = bmp;



             
               }
       }
        catch (ArgumentException ex)
        {
                   
         }


    PS.Shakeer Hussain Hyderabad
    Tuesday, July 20, 2010 5:34 AM