PC Review Forums Newsgroups Microsoft DotNet Microsoft Dot NET Compact Framework How to close Camera app after opening it using CameraCaptureDialog

Reply

How to close Camera app after opening it using CameraCaptureDialog

 
Thread Tools Rate Thread
Old 02-03-2006, 08:05 PM   #1
Heather B.
Guest
 
Posts: n/a
Default How to close Camera app after opening it using CameraCaptureDialog


Hi,

I am using the following code from my VB.NET program to take a picture and
save it to the database. Everything works fine, except when I close my
program, the camera application is still open. Is there anyway to close
this app from inside of VB after I'm done taking pics?

Dim cameraDialog As New CameraCaptureDialog

With cameraDialog
.Owner = Me
.Mode = CameraCaptureMode.Still
.StillQuality = CameraCaptureStillQuality.Normal
.Title = "Take a Picture"
.DefaultFileName = strFileName
.InitialDirectory = strDirectory
End With

'code that saves the picture to the database
and displays it in a list

cameraDialog = Nothing

Thanks,
Heather
  Reply With Quote
Old 02-03-2006, 08:13 PM   #2
Paul G. Tobey [eMVP]
Guest
 
Posts: n/a
Default Re: How to close Camera app after opening it using CameraCaptureDialog

You could try sending the OK button to it as a key. OpenNETCF has a wrapper
for PostKeybdMessage that should do that.

Not sure that this is the best/right way to do it, but I think that it will
work.

Paul T.

"Heather B." <hbaker@pro-merchnospam.com> wrote in message
news:c73b41a28c7140bbbcb44346425bd93d@ureader.com...
> Hi,
>
> I am using the following code from my VB.NET program to take a picture and
> save it to the database. Everything works fine, except when I close my
> program, the camera application is still open. Is there anyway to close
> this app from inside of VB after I'm done taking pics?
>
> Dim cameraDialog As New CameraCaptureDialog
>
> With cameraDialog
> .Owner = Me
> .Mode = CameraCaptureMode.Still
> .StillQuality = CameraCaptureStillQuality.Normal
> .Title = "Take a Picture"
> .DefaultFileName = strFileName
> .InitialDirectory = strDirectory
> End With
>
> 'code that saves the picture to the database
> and displays it in a list
>
> cameraDialog = Nothing
>
> Thanks,
> Heather



  Reply With Quote
Old 11-04-2006, 04:05 PM   #3
=?Utf-8?B?ZGVybWl0ZQ==?=
Guest
 
Posts: n/a
Default Re: How to close Camera app after opening it using CameraCaptureDi

I'd just like to know if a solution to this problem was ever identified. I
have run into the same issue in a C# app. If possible, I'd like a solution
that does not involve OpenNETCF, since my app does not otherwise require it.

Thank you,

Matthew Fleming
DermVision
  Reply With Quote
Old 15-04-2006, 06:35 PM   #4
=?Utf-8?B?ZGVybWl0ZQ==?=
Guest
 
Posts: n/a
Default Re: How to close Camera app after opening it using CameraCaptureDi



"Paul G. Tobey [eMVP]" wrote:

> You could try sending the OK button to it as a key. OpenNETCF has a wrapper
> for PostKeybdMessage that should do that.
>
> Not sure that this is the best/right way to do it, but I think that it will
> work.
>
> Paul T.


I wasn't able to follow this advice, because I couldn't figure out how to
press the "OK" button using PostKeybdMessage. There is a virtual key code for
a mouse click, but how can we know the pointer is positioned over the button?

Instead, here is what seems to work:

extern "C" __declspec(dllexport)
void closeCameraApp() {

HWND cameraHandle = FindWindow(L"WCE_IA_Camera_Main", NULL);
if (cameraHandle!=NULL)
SendMessage(cameraHandle, WM_CLOSE, NULL, NULL);
}

This is called via PInvoke from managed code, of course. The
"WCE_IA_Camera_Main" window class I got using Remote Spy. Hopefully it will
work for CameraCaptureDialog running on any device, but I have only one
device for testing, an HTC Apache.

Regards,

Matthew Fleming
DermVision, LLC



  Reply With Quote
Reply



Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off