View Full Version : how to know when camera is disconnected?
June 20, 2007, 11:45:23
im using the image source camera in my MFC project (vc6.0)
when the camera is running (in live), if there is any problem with cable, camera or any malfunction, how to catch that error and also i need show the error to another dialog which i have created in my project..?
im using MFC dialog based application.
thanks in advance
June 20, 2007, 12:59:10
In order to detect a lost camera you can use the device lost event:
If you inherit an own class from GrabberListener, you can past the handle of your application's window to the new class. If the DeviceLost event fires, you can post a message to your main application. The application can react in its message handler to this message.
Following code shows the deviceLost method in the GrabberListener inherited CListener class:
/*! Set the parent window handle that recieves the device lost
message. It must be called from the application's main window.
void CListener::SetParentWindow(CWnd *pcDrawWindow)
m_hParentWindow = pcDrawWindow;
void CListener::deviceLost( Grabber& param)
In the application's window the message map must be enhanced:
ON_MESSAGE(WM_USER+1, OnDeviceLost) // <- Its the new message!
And this is the "OnDeviceLost" method:
// Clear the grabber obkect.
Powered by vBulletin® Version 4.2.3 Copyright © 2015 vBulletin Solutions, Inc. All rights reserved.