Jump to content
  • Advertisement
Sign in to follow this  
Songoku

WinApi

This topic is 5132 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

Hi there, i have a real problem. I am improving my base code and i want to do it very well. So i first made a few design choices and got a problem. I want to create a window class which holds a function LRESULT CALLBACK WndProc(HWND....). But it does not work. Is there a way to get the windows callback funtion into a class. I want the function to be really inside the class and not to be outside the class and then to use a function pointer to the outer global windows callback funtion inside my class. Thanks for help and sorry for my bad english.

Share this post


Link to post
Share on other sites
Advertisement
There is an article on this site about doing just that. I forget what it's called, but I think it's fairly recent.

Share this post


Link to post
Share on other sites
Due to calling convention limitations, you can't assign a normal member function as the window procedure, but you can assign a static member function. That function, in turn, can call a member function after extracting a pointer from the window procedure, usually through the GWL_USERDATA flag with GetWindowLongPtr(). This data is usually assigned when handling the WM_NCCREATE message, from the LPCREATESTRUCT that is passed during window creation.

For more information, you might want to read this article.

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!