Hi,
I will explain a little bit of what I am trying to do:
I am grabbing some images useing a camera and a framegrabber.
These images I am displaying in a window that I created using a
function of the framegrabber.
My application has to a area to draw a graphic (this graphic is to the
gray values of a line of pixels, that I get from the images that I am
grabbing).
So, I need to grab some images and draw a graphic using data from
this image.
I tryied 2 solutions:
1- I have created only one thread to grab the images, and I call the draw
function inside the OnPaint function. The problem is that I need everytime
minimie and maximize my application to call the OnPaint function and then
visualize the graphic.
2- I tryied to do 2 thread functions, but the problem is that I need to acess
the same image pointer inside these 2 thread functions...and I did not find a
tutorial that explain me how to use lock and unlock functions very well.
It is very important to notice that the window that I am displaying the grabbed
images is created with a function from the framegrabber and it is not "inside my
application." In another world, when I start grabbing I have 2 windows, one
for the grabbed images and another one the is my intire application.
Please,
can you help me!
Many thanks
Gordo

Problem with OnPaint and ThreadFunc
Christoc
I have a pointer to the image that I am grabbing with the framegrabber.
How can I link this image pointer with a static area on my application!
I think that is easier (but I do not know how to do :) ). This image pointer is unsigned long* and I can convert it to a IplImage* (to use OpenCV Librarie). So the problem now is this: I have a image pointer and a static area, so, how can I link this two things to display the images on this static area!
Many thanks,
Gordo
devender 1623
1- Call InvalidateRect/Invalidate to force a WM_PAINT on the next message cycle.
2- There is something called "Critical Section", and the MFC has CCriticalSection to allow an easy synchronisation between threads.
I don't understand the last part of your post! What do you mean with "is not inside my application" How do you transfer the images from one part of your application to the other if it is not inside
David Sceppa - Microsoft
"I don't understand the last part of your post! What do you mean with "is not inside my application" How do you transfer the images from one part of your application to the other if it is not inside "
I am displaying the grabbed images in a window that I have created using a function of the frame grabber. So, when I press the button to start the
grabbing, I call one function, and this function only work with functions of
the framegrabber, like: createDisplay, DrawBuffer. So, when I am grabbing some
images I have 2 windows: the first is only for the camera (display what the camera is grabbing) and the second window is my application (with buttons, statics and so on).
This is the next step of my program, I need to display this window with the
grabbed images on a specific static area on my application.
So, everything is inside my application only the window that I use to display the
grabbed images are not on my application, it is a second window...and this is
because I am createing this window with a framegrabber function.
Bravo
Shouldn't be a problem. when the frame grabber creates this windows it takes some parameter from you (right ), maybe there is a parent window you have to define, or you are allowed to just set the parent of this window to be a child of your application (SetParent).
I don't know the software you are using, but I am sure that the hardware/software vendor has some documentation about this. What does it say What sample code you have
It seams we are drifting to an Off Topic subject.