Results 1 to 20 of 20

Thread: callback in a class

Threaded View

  1. #1

    Thread Starter
    PowerPoster
    Join Date
    Feb 2002
    Location
    Canada, Toronto
    Posts
    5,803

    callback in a class

    I need to make a callback for a function in a class, when i just declare the function itself, the compiler complains when i want to pass the pointer to the function.

    I know the anser has to do with a typedef (did something like this a long time ago), but I forgot how to declare the function with it....

    here's something similar to what I have
    Code:
    class myclass
    {
    private:
        void CALLBACK myCallbackFunction(long num);
        void some_other_function(void);
    }
    
    void CALLBACK myclass::myCallbackFunction(long num)
    {
    }
    
    void myclass::some_other_function(void)
    {
          // compiler gives error on next line
          // cannot convert (function prototype here) to DWORD_PTR
          
          ret = API_function((DWORD_PTR)myCallbackFunction);
    }
    Anyone knows how to make it work ?
    Last edited by CVMichael; Jan 29th, 2003 at 03:11 AM.

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