WndProc within a class

Started by
1 comment, last by Matrinix 14 years, 1 month ago
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
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.
Alright, thanks for your help! :)

This topic is closed to new replies.

Advertisement