Jump to content
  • Advertisement

Archived

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

DJohnson

CALLBACK functions (Vis C++ Win32)

This topic is 5784 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
Advertisement
humm...
did you try
cls.lpfnWndProc = m_WndProc;

?? or maybe it''s

cls.lpfnWndProc = this::m_WndProc


try it. i don''t really know though.

Share this post


Link to post
Share on other sites
Guest Anonymous Poster
just make m_WndProc a static member function.

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

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!