PDA

View Full Version : Device lost problem



selvanathan
October 13, 2008, 15:16:48
Dear Sir,
I am using deviceLost() to find camera unplugging on run time... but it will not find out camera unplugging on run time.... i attached my source code for your reference... plz refer that and find my mistake....

thanks in advance

Stefan Geissler
October 13, 2008, 16:33:20
Selvanathan

Thank you for showing me the project, that makes things much easier for me. I found two errors:

You wrote


void CListener_Cam1::deviceLost( Grabber& param)
{
if( m_pParent != NULL)
{
m_pParent->PostMessage(WM_USER+13,0,0);
}
}


but your message handler is:



ON_MESSAGE(WM_USER+1,OnDeviceLost)



Please change it from "1" to "13".


The second error is in following line:

m_pGrabber_Cam1->addListener( m_pListener_Cam1, GrabberListener::eFRAMEREADY);
This advises the listener only to listen to the frame ready, but not to the device lost event. Please write following line instead:

m_pGrabber_Cam1->addListener( m_pListener_Cam1);

I tested it and your messagebox was shown, when the device was unplugged.

selvanathan
October 14, 2008, 04:05:34
Dear Stefan
Thank u for u r valuable reply.... now its working fine....