dimanche 20 avril 2014

Windows mobiles - CameraCaptureDialog lève erreur sur ShowDialog - Stack Overflow


I hope someone can help me with this issue.


I have a simple application written in VS2008, .NETCF 3.5, C#. The application has one form and one button on it. The issue is happening on device that supports camera (Motorola MC9590).


The button starts CameraCaptureDialog but on ShowDialog(), it throws "An unknown error".


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 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()

Any help is highly appreciated.


Thanks,



I hope someone can help me with this issue.


I have a simple application written in VS2008, .NETCF 3.5, C#. The application has one form and one button on it. The issue is happening on device that supports camera (Motorola MC9590).


The button starts CameraCaptureDialog but on ShowDialog(), it throws "An unknown error".


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 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()

Any help is highly appreciated.


Thanks,


0 commentaires:

Enregistrer un commentaire