• Advertisement
Sign in to follow this  

WndProc within a class

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

Hello everyone, I am trying to abstract WndProc into a cross-platform Window class I am writing. I saw this article (http://www.gamedev.net/reference/articles/article1810.asp) and this forum post (http://www.gamedev.net/community/forums/topic.asp?topic_id=303854) on how to do it. My question, is this method safe to use? I've read at places that the GWL_USERDATA can get overwritten by other applications (or by code you have not introduced). Also is this considered a fast way to do it? I want to use this to tie in with user input so I want to minimize the amount of time it takes to process a key or mouse event. Thanks for your help! -Matrinix

Share this post


Link to post
Share on other sites
Advertisement
Quote:
Original post by Matrinix

My question, is this method safe to use? I've read at places that the GWL_USERDATA can get overwritten by other applications (or by code you have not introduced).

If other code can do that, it might as well replace your window procedure wholesale with GWL_WNDPROC. In other words, not only it is not worth worrying about, there's nothing you could do to stop it.

Quote:
Also is this considered a fast way to do it? I want to use this to tie in with user input so I want to minimize the amount of time it takes to process a key or mouse event.

Yes. The handler is a simple trampoline function, and will be imperceptible in your application's performance, profiled or not.

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement