Wrap Window Creating to class?
I am new to Win32 programming and im planning to wrap all the window creating and message handling in a class. My problem is Specifying the WNCLASS.lpfnWndProc, yeah i knw this is the name of the function that handles my widow procedure but what to specify if my window initialization/creation is inside the class?
to make things clear heres a sample
//in class CAPP.cpp
bool CAPP::createWindow(.....)
{
//window creation here
}
I want My Message handler to be inside the class too
ex
bool CAPP::myWinProc(...)
{
...
}
//in main.cpp
int .. WinMain ...
CAPP app=new CAPP(...)
app.createWindow( );
How do i Do this
thanks in advance
:)
You need to declare the member function that is to be used as the window proc as 'static' and set up the WNDCLASS structure to point to that procedure. Unfortunately, you won't have a 'this' pointer in that function so you'll need to come up with a way to get hold of the 'this' pointer yourself.
Search the forums - this has been discussed before.
Skizz
Search the forums - this has been discussed before.
Skizz
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement