CameraCaptureDialog throws "An unknown error occured"

D Dino B. 3 years 7 months ago
2 1 0

Hello,
I hope someone can help me with this.
I wrote simple application in VS2008, .NETCF 3.5, C#.  The application has 1 form and one button on it.  This is happening on device that supports camera (Motorola MC9590).
The button starts CameraCaptureDialog but on ShowDialog, it throws "An unknown error".
Screenshot of form, error, and code provided below
The code behind Camera button is:
private void btnCam_Click(object sender, EventArgs e){   string strFileName = "";   try   {     using (CameraCaptureDialog cam = new CameraCaptureDialog())     {       cam.Owner = this;       cam.InitialDirectory = @"\My Documents";       cam.DefaultFileName = @"test.jpg";       cam.Mode = CameraCaptureMode.Still;       cam.StillQuality = CameraCaptureStillQuality.High;       cam.Title = "TESTING";       DialogResult dlg;       dlg = cam.ShowDialog();  //**** THIS IS WHERE IT THROWS ERROR ****       if (dlg == DialogResult.OK)       {         strFileName = cam.FileName;       }     }  // end of using   }   catch(Exception ex)   {     MessageBox.Show("Error: " + ex.Message + " Stack: " + ex.StackTrace);   } }
And this is the error:

And full Stack Trace:
at Microsoft.WindowsMobile.Forms.CameraCaptureDialog.LaunchCameraCaptureDialog(IntPtr ptrStruct) at Microsoft.WindowsMobile.Forms.CameraCaptureDialog.ShowDialog() at CameraAndSymbolBarcodeTest.Form1.btnCam_Click(Object sender, EventArgs e) at System.Windows.Forms.Control.OnClick(EventArgs e) at System.Windows.Forms.Button.OnClick(EventArgs e) at System.Windows.Forms.ButtonBase.WnProc(WM wm, Int32 wParam, Int32 lParam) at System.Windows.Forms.Control._InternalWnProc(WM wm, Int32 wParam, Int32 lParam) at Microsoft.AGL.Forms.EVL.EnterMainLoop(IntPtr hwnMain) at System.Windows.Forms.Application.Run(Form fm) at CameraTest.Program.Main()I hope someone can help me with this. 
Much appreciated
Much appreciated.

Please Register or Login to post a reply

1 Replies

E Efkan YILMAZ

Are you using the scanner, or is datawedge running and has the scanner active?  I think the scanner and the camera are multiplexed in the hardware, so only one can be active at a time.

CONTACT
Can’t find what you’re looking for?