Click to See Complete Forum and Search --> : callback functions


Rupert Bates
May 19th, 1999, 11:43 AM
Hi, I hope this is an easy one for somebody out there. I can't work out how to pass the address of a callback function to the LineDDA function from the GDI SDK.
I have a function in the class which calls LineDDA:

void CALLBACK swLine::AddPoint(int x, int y, LPARAM lpData)



and I want to pass it to LineDDA, I tried:

LineDDA(x1, y1, x2, y2, &AddPoint, 0);



amongst other things but just get a variety of errors.
If someone could help me out I would be most grateful.
Rupert

Jaeyeon Lee
May 19th, 1999, 07:43 PM
A member function of a class cannot be a callback function because it has a hidden argument "this".
If you want to implement the callback function as a member of a class, you must make it static.
Also, you use AddPoint instead of &AddPoint.