Here is my class:
Suppose that every time I click on the window, I want it to increment the value of num_squares. Then, I want it to draw that number of squares onto the window. Therefore, DrawSquare() must be able to access the value of num_squares. This means that it cannot be static. This then means that it cannot be called by WndProc...Code:class MyWindow { public: // Attributes int num_squares; // Functions MyWindow() { num_squares = 0; // Other stuff like registering the window class }; static LRESULT CALLBACK WndProc(HWND hwnd, UINT msg, WPARAM w_param, LPARAM l_param); void DrawSquare(); };
I can see that your class CCallBack would work in a static sense, but how can you let CCallBack know that value of num_squares?
Thanks again!




Reply With Quote