Jump to content
  • Advertisement
Sign in to follow this  
yuppies

Wrap Window Creating to class?

This topic is 5226 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
Advertisement
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
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!