Mobile Line Of Business

Richard Jones (MVP)

  Home  |   Contact  |   Syndication    |   Login
  202 Posts | 0 Stories | 36 Comments | 0 Trackbacks

News

Welcome to the Mobile Line Of Business Blog

Tag Cloud


Archives

Post Categories

About

So, got the Motorola MC75 working with its inbuilt camera.   However during a demo the other day I inadvertently clicked my camera capture button on a device that doesn't have an inbuilt camera (doh).

Of course my application then blew up.

So here's the code that performs a camera capture but also detects (well catches) if the device doesn't have one...

 

try

            {

CameraCaptureDialog ccd = new CameraCaptureDialog();

                ccd.InitialDirectory = @"\";

                ccd.DefaultFileName = "test.jpg";

                ccd.Mode = CameraCaptureMode.Still;

                ccd.Resolution = new Size(640, 480);

DialogResult dr1 = ccd.ShowDialog();

if (dr1 == DialogResult.OK)

                {

                    Bitmap _Photo = new Bitmap(ccd.FileName);

// put your code in here todo something with the image

                }

                ccd.Dispose();

            }

catch

            {

MessageBox.Show("No Camera Attached", "No Camera", MessageBoxButtons.OK, MessageBoxIcon.Exclamation, MessageBoxDefaultButton.Button1);

            }

posted on Monday, December 1, 2008 4:44 PM