CALLBACK functions (Vis C++ Win32)
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;
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.
did you try
cls.lpfnWndProc = m_WndProc;
?? or maybe it''s
cls.lpfnWndProc = this::m_WndProc
try it. i don''t really know though.
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.
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement