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
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...
Thank you,
Matthew Fleming
DermVision
"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