Hello,

I am just starting out trying to write a Windows application using the Windows API, but I am having problems understanding the WndProc() function. I know that WndProc() is called whenever any user input is detected, such as a key being pressed or the mouse being clicked. So, I want to perform a function (such as drawing a box onto the window) whenever a mouse click is performed. This can be defined as a function inside my class, but it would be a non-static function, because it requires access to certain member variables of my class (such as the location to draw the box - which can change and is non-static). However, I cannot call the non-static function from the static function WndProc()...

I tried setting this variable as a global variable, but i) isn't this bad practice and ii) this means that I can only have one instance of my window class running. I need to be able to call non-static functions and acces non-static variables from the WndProc() function in order to process the user input.

How can this be done?

Thanks!