I followed your suggestion, the only think I did slightly differently is this part:
Code: Select all
virtual void OnImageGrabbed(CInstantCamera& camera, const CGrabResultPtr& ptrGrabResult)
{
wxCommandEvent evt(wxEVT_GRABBED);
evt.SetExtraLong((long) &ptrGrabResult);
wxPostEvent(handler, evt);
if (ptrGrabResult && ptrGrabResult->GrabSucceeded())
{
wxCriticalSectionLocker lock(handler->m_bitmap_cs);
// Access the image data.
cout << "SizeX: " << ptrGrabResult->GetWidth() << endl;
cout << "SizeY: " << ptrGrabResult->GetHeight() << endl;
unsigned char *pImageBuffer = (unsigned char *) ptrGrabResult->GetBuffer();
int width = (int) ptrGrabResult->GetWidth();
int height = (int) ptrGrabResult->GetHeight();
handler->toWXBitmap(pImageBuffer, width, height);
handler->Refresh();
}
else
{
cout << "Error: " << ptrGrabResult->GetErrorCode() << " " << ptrGrabResult->GetErrorDescription() << endl;
}
}
The problem I have now is the same as some days ago: even if I call Refresh() the OnPaint method is never called (unless once right after the constructor has done).
I attach my code if someone would like to take a look.
I hope this is the last barrier between me and the solution..do you have suggestions to overcome this problem? Thank you!!!