Archived

This topic is now archived and is closed to further replies.

CALLBACK functions (Vis C++ Win32)

This topic is 5502 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

I seem to be unable to implement a CALLBACK function within my class. Is this illegal or am I just doing it wrong? More specifically, I''m trying to place the WndProc within my Window class and this make the compiler a bit angry. cls.lpfnWndProc = (WNDPROC)this->m_WndProc;

Share this post


Link to post
Share on other sites
Member functions are different to regular functions; they have the implicit this parameter. You could make the window procedure static, but then you won''t be able to access member variables directly. However, if you use GetWindowLong/SetWindowLong, you can get a pointer to the window object from within the window procedure. There''s a good article showing that technique.

Share this post


Link to post
Share on other sites