edit : with WndProc...*
First of all, let me apologize if I'm in the wrong section of the forum. If I am, please indicate me where is the right place.
Well, as a Win32 programmer, there was a day when I said: "For me enough of all of this window creation procedures" (refering to those WNDCLASS, HWND, CreateWindow, etc...). So I wanted to make my own class, in a way that I could be able to create my windows with just one or two lines in my main method. Like:
Window w("WindowName", 0, 0, 500, 500);
After good hours of research, I made it. I created my own class with the static WndProc redirecting to the non-static one.
Even, in my main I can do stuffs like:
Properly creating the eventFunction and passing it's pointer.
However, my problem now is to deal with controls (buttons, edit boxes, scroll bars, and so). I guess there is no how to indicate their respectives WndProcs, since the WM_NCCREATE does not get call when dealing with these controls.
My static WndProc process follows:
And in my class constructor, after creating the HWND, I call
LRESULT CALLBACK OglWindow::staticHandler(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam)
OglWindow *window = NULL;
if (msg == WM_NCCREATE)
SetWindowLong(hWnd, GWL_USERDATA, (long)((LPCREATESTRUCT(lParam))->lpCreateParams));
else window = (OglWindow *)GetWindowLong(hWnd, GWL_USERDATA);
currentWindow = window;
window->mainHandler(msg, wParam, lParam);
return DefWindowProc(hWnd, msg, wParam, lParam);
Now I just need a way to deal with my controls, and call the CallWindowProc(oldProc, hWnd, msg, wParam, lParam) at the end.
this->oldProc = (WNDPROC)SetWindowLongPtr(window, GWL_WNDPROC, (LONG_PTR)staticHandler);
I want to sorry you for my english, as well. I made my best with some help of the Google Tradutor