Sign in to follow this  

Using method as WndProc in WinApi

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

How can I use some method insted of function in WinApi while creating window. When I wrote wc.lpfnWndProc = (WNDPROC) WindowProc; I got this: error C2440: 'type cast' : cannot convert from 'overloaded-function' to 'WNDPROC' WindowProc is my method in class Window

Share this post


Link to post
Share on other sites
Make it static. Of course, then that raises the question of how the static member knows which instance the call is being made against. Some respond by making it a singleton wrapper class (ewww). Others use SetWindowLongPtr and GetWindowLongPtr to associate the instance pointer with the window handle.

I wrote an article on the subject. Check my profile for user contributions or Google for it.

Share this post


Link to post
Share on other sites

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