CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 2 of 2
  1. #1
    Join Date
    Apr 1999
    Posts
    30

    callback functions

    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


  2. #2
    Join Date
    May 1999
    Location
    Republic of Korea
    Posts
    74

    Re: callback functions

    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.



Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured