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)
if (ptrGrabResult && ptrGrabResult->GrabSucceeded())
// 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);
cout << "Error: " << ptrGrabResult->GetErrorCode() << " " << ptrGrabResult->GetErrorDescription() << endl;
where I could not use 'this' since I was in the secondary thread, therefore I used the handler to the main GUI.
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!!!