Window Procedure inside a class - Problems with static - Non-static and access to other class functions
Posted on 2003-10-27
Hi people. Here is my problem.
My problem basicaly is: Im creating a class for a window, and i have a window procedure inside this class. But inside the WNDCLASSEX lpfnWndProc i must declare the MyWindow::WinProc function. And the compiler just dont accept this, only if i declare WinProc as STATIC. Declaring static, all looks ok, but now i cant access the other class functions from inside WinProc procedure. Oh my, there´s is no solution for this?
Thanks a lot for your help!!
Here is the code:
HWND window, button1, button2, BckImage;
static LRESULT CALLBACK WinProc(HWND,UINT,WPARAM,LPARAM);
void MyWindow::RegClass(HINSTANCE h)
w.lpfnWndProc = WinProc;
// here is all the variables of WNDCLASSEX
void Create(HWND parent, HINSTANCE h)
// here comes the creation of windows, etc...
LRESULT CALLBACK MyWindow::WinProc(HWND hwnd, UINT msg, WPARAM w, LPARAM l)
// here is the window procedure code,etc...