Page 1 of 1

Callbacks

Posted: Wed Jul 14, 2010 1:42 pm
by avelazquez
I am currently working on a project and I want to know how to utilize callbacks. If it makes a difference i am using vc .net. Which makes the MFC example slightly difficult to follow. As I read a previous thread (creating a callback method in C++ ) I noticed someone commenting on the existence of less convoluted examples.

I was polling for frames, but I realized that this is not suitable for what I am doing. Thus I need to know how to initialize callback events on vc .net.

Thanks!

Re: Callbacks

Posted: Wed Jul 14, 2010 2:38 pm
by Birch
Here is a link to a website which might have some examples of frame callbacks in C++:
I used a C++ callback in a non MFC application. The source code is available at: http://surfacetracker.sourceforge.net. Look at the class OptitrackCamera.
http://surfacetracker.sourceforge.net/

It comes form this thread on our forums:
http://forum.naturalpoint.com/forum/ubb ... 863&page=1

Callbacks

Posted: Fri Jul 16, 2010 10:28 am
by avelazquez
Hello as I try to figure out callbacks in the VC .net framework I have hit another dead end. I checked the following link http://surfacetracker.sourceforge.net/ which has some very useful information.

Any further information will be greatly appreciated!

Below is a small section of what I'm trying to do:

/*inside the main function I have the following but it does not work, what I'm attempting to do is declare a pointer to the function FrameAvailable such that when a new frame is available my function FrameAvailableHandle is executed

I know i'm doing something wrong, but I don't know what?

*/



void(*FrameAvailableHandle)(struct INPCamera *pCamera); // where FrameAvailableHandle is the function that will be executed everytime there is a new frame
FrameAvailableHandle=(void *) FrameAvailable(); //where FrameAvailable is the Method

Re: Callbacks

Posted: Fri Jul 16, 2010 4:47 pm
by Birch
Please check out the "C++ VC8/2005" sample posted to our website. I'd recommend searching the entire project for "FrameAvailable" to see what you may be missing.