Putting WndProc into a class?

Started by
4 comments, last by Eber Kain 22 years, 4 months ago
I cant get my program to compile if WndProc is in a class? this line (setting up the window class) wc.lpfnWndProc = WndProc; causes this error C:\Programming\Projects\msvc\OpenGL Helper Library\glh.cpp(151) : error C2440: ''='' : cannot convert from ''long (__stdcall glhs::*)(struct HWND__ *,unsigned int,unsigned int,long)'' to ''long (__stdcall *)(struct HWND__ *,unsigned int,unsigned int,long
www.EberKain.comThere it is, Television, Look Listen Kneel Pray.
Advertisement
Then the wndproc function and the function in your class are different in some way

Someone else will give you a better answer below:
Then the wndproc function and the function in your class are different in some way

Someone else will give you a better answer below:
declare it as static
well that worked, but now it acts like its not a member of the class.

It gives error on ever member variabe reference


I got a bypass to this problem, but makeing a dummy WndProc functions, and passing all its data to my WndProc class function.

LRESULT CALLBACK WndProc(HWND p_hwn,UINT p_msg,WPARAM p_wparam,LPARAM p_lparam) {
return glh.WProc(p_hwn, p_msg, p_wparam, p_lparam);
}

What sort of overhead would there be in something like this?

Edited by - Eber Kain on December 13, 2001 7:38:47 PM
www.EberKain.comThere it is, Television, Look Listen Kneel Pray.
WinProc inside a class?
How do I turn my message procedure into a member of a class?
Windows in a class(1)
Windows in a class(2)

That should be enough. All on this board, found by using "the leetle search button in the corner."

[ GDNet Start Here | GDNet FAQ | MS RTFM | STL | Google ]
Thanks to Kylotan for the idea!

This topic is closed to new replies.

Advertisement