Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

How to close Camera app after opening it using CameraCaptureDialog

43 views
Skip to first unread message

Heather B.

unread,
Mar 2, 2006, 3:05:10 PM3/2/06
to
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

Paul G. Tobey [eMVP]

unread,
Mar 2, 2006, 3:13:11 PM3/2/06
to
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." <hba...@pro-merchnospam.com> wrote in message
news:c73b41a28c7140bb...@ureader.com...

dermite

unread,
Apr 11, 2006, 11:05:02 AM4/11/06
to
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

dermite

unread,
Apr 15, 2006, 1:35:01 PM4/15/06
to

"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


0 new messages