Managed Camera API raises an Unknown Exception ?!?

Hi All,

I tried to run the following code:

Microsoft.WindowsMobile.Forms.CameraCaptureDialog myPictureTaker =

new Microsoft.WindowsMobile.Forms.CameraCaptureDialog();

if (myPictureTaker.ShowDialog() == DialogResult.OK)

{

string myPicture = myPictureTaker.FileName;

Image MyImage = (Image)new Bitmap(myPicture);

pictureBox1.Image = MyImage;

}

myPictureTaker.Dispose();

The line that shows the dialog 'myPictureTaker.ShowDialog()' raises an unknown exception when run on my Windows Mobile 5 IPaq hw6915. The actual exception details are:

System.InvalidOperationException was unhandled
Message="An unknown error occurred."
StackTrace:
at Microsoft.WindowsMobile.Forms.CameraCaptureDialog.LaunchCameraCaptureDialog()
at Microsoft.WindowsMobile.Forms.CameraCaptureDialog.ShowDialog()
at StatusMWS.frmFinal.btnSave_Click()
at System.Windows.Forms.Control.OnClick()
at System.Windows.Forms.Button.OnClick()
at System.Windows.Forms.ButtonBase.WnProc()
at System.Windows.Forms.Control._InternalWnProc()
at Microsoft.AGL.Forms.EVL.EnterModalDialog()
at System.Windows.Forms.Form.ShowDialog()
at StatusMWS.frmReason.btnAccept_Click()
at System.Windows.Forms.Control.OnClick()
at System.Windows.Forms.Button.OnClick()
at System.Windows.Forms.ButtonBase.WnProc()
at System.Windows.Forms.Control._InternalWnProc()
at Microsoft.AGL.Forms.EVL.EnterModalDialog()
at System.Windows.Forms.Form.ShowDialog()
at StatusMWS.frmAddr.btnSelect_Click()
at System.Windows.Forms.Control.OnClick()
at System.Windows.Forms.Button.OnClick()
at System.Windows.Forms.ButtonBase.WnProc()
at System.Windows.Forms.Control._InternalWnProc()
at Microsoft.AGL.Forms.EVL.EnterModalDialog()
at System.Windows.Forms.Form.ShowDialog()
at StatusMWS.frmMain.btnMBReport_Click()
at System.Windows.Forms.Control.OnClick()
at System.Windows.Forms.Button.OnClick()
at System.Windows.Forms.ButtonBase.WnProc()
at System.Windows.Forms.Control._InternalWnProc()
at Microsoft.AGL.Forms.EVL.EnterMainLoop()
at System.Windows.Forms.Application.Run()
at StatusMWS.Program.Main()

I try to run this code in a button click event thats on a form that is Maximized. Anyone know why I'm getting this problem Any help would be appreciated.

Thanks



Answer this question

Managed Camera API raises an Unknown Exception ?!?

  • AlanKohl

    Hi Noah,

    Appreciate the reply. I will do that now.

    I've been trying to work around it using C++ and actually have the API working now. Unfortunately even though the API attempts to give simple access to the device camera I'm dissappointed by 1) Its performance and 2) the lack of control over the dialog. I'm now looking at using DirectShow and the filtergraph API to do this. Now I have limited directX and C++ knowledge and this stuff is very advanced. I think MS have a good sample of using the filtergraph to capture a still image. All I have to do is wrap it up somehow.

    Anyway I would still like to know what is going wrong the Managed code. I should like to be able to use something like this in the future and also help feedback improvements to the interface.

    Thanks

    Richard


  • pcompassion

    You might have better luck posting this over in the microsoft.public.pocketpc.developer or microsoft.public.smartphone.developer forums since it is specific to the Windows Mobile APIs. The developers that actually wrote the Windows Mobile class libraries probably don't look in this forum as frequently. Hope they can help you out,
    -Noah Falk
    .Net Compact Framework

  • Managed Camera API raises an Unknown Exception ?!?