I have wrapped up a window in a class, but WndProc has to be a static function of the class. But what if I want to make use of a variable from that class in the function.
Example. I have a member varaible called hInst. It is the HINSTANCE you get when you start a win application. but since WndProc is static I can't use normal member variables. So I thought I had to make the member variable static too. But that didn't help (Well it is probably my fault, because I am pretty sure it whould work. Here is a snapshot of the code. I guess I am messing up the function definition or something? Or any other advice?
.h file
.c fileCode:class Device{ public: Device(); ~Device(); private: static LRESULT WndProc( HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam ); static HINSTANCE hInst; // Hinstance to our window };
Cheers,Code:LRESULT CALLBACK Device::WndProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam){ static PAINTSTRUCT paintstruct; switch (message){ //This is sent following WM_NCCREATE -- we can assume our window is up //If it gets this far case WM_CREATE:{ CreateWndControls(hwnd, hInst); FillControls(); break; }
RyanJ
__________________




Reply With Quote