RE: Managed CameraCaptureDialog class causes an Unknown Exception...

Tech-Archive recommends: Fix windows errors by optimizing your registry



I am getting exactly the same error, though it seems to occur at random
intervals.
I have tried on the imate k-jam, jamin and the new jasjam.

I have tried everything from calling the garbage collector, disposing of
objects, checking memory and background running processes etc.
The k-jam's and jamin's error occurrs every now and then, while the jasjam
on every second attempt to call the "CameraCaptureDialog.ShowDialog()". If I
exit out of the application and run it again, it will capture the first image
fine.

I have browsed the msdn forums and there are a number of developers with the
same issue, though no one has been able to provide a solution. We have a
number of users out in the field with devices running the application, so
exiting and restarting everytime the user wants to take another photo is not
a solution I can use.

Error Information is as follows:
HRESULT: -2146233079
InnerException: NULL
Message: An unknown error occurred
Stack Trace:
at
Microsoft.WindowsMobile.Forms.CameraCaptureDialog.LaunchCameraCaptureDialog()
at Microsoft.WindowsMobile.Forms.CameraCaptureDialog.ShowDialog().....

Any help, suggestions or input (or even better - the actual solution) would
be greatly appreciated.


"Noz" wrote:

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.

I've since used Embedded C++ to access this API directly and do not get an
error but the performance is terrible. I'm not a C++ developer so would like
to get the managed code working. Am I not setting correct properties in the
Managed code? I noticed the native code fails if the file already exists by
returing an E_INVARGS.

I'm now looking at DirectShow to do this. Is it well supported? I would
like to know why the Managed code isn't working but I need a solution quick.
Is there another way of getting at the general camera API apart from what I
mentioned here?

Thanks

.


Quantcast