Sign in to follow this  

Wrap Window Creating to class?

This topic is 4861 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

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 :)

Share this post


Link to post
Share on other sites
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

Share this post


Link to post
Share on other sites

This topic is 4861 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this