Classes and static call back procedures
I understood this a while back, but now, with more knowledge of Windows, I don't understand:
When a callback procedure is a class member function, it must be declared static, so that there is a copy available at all times. But, in this code, there IS already a copy available.
Code:
class benny
{
public:
LRESULT CALLBACK WndProc(params);
BOOL Create(params);
};
LRESULT CALLBACK benny::WndProc(params)
{
blah
}
BOOL benny::Create(params)
{
WNDCLASSEX wcx;
wcx.lpfnWndProc=WndProc;
There IS already an instance of the window procedure, because for the Create function to run, someone must have created an instance of the class. Why then, can I not do away with static?