Archived

This topic is now archived and is closed to further replies.

Possible (minor) bug in Nehe code? WM_SYSCOMMAND

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

Possible bug, can someone confirm/reject? In the message callback function of lesson #1, (yes its tried and tested i know), there is provision to handle the screen saver and monitor powerdown system messages and prevent them from being executed by the system when the project is active. (Lines 296-305 of lesson1.cpp, WM_SYSCOMMAND) The Win32 Programmer''s Reference states:
quote:
In WM_SYSCOMMAND messages, the four low-order bits of the uCmdType parameter are used internally by Windows. To obtain the correct result when testing the value of uCmdType, an application must combine the value 0xFFF0 with the uCmdType value by using the bitwise AND operator.
This is not done in the tutorial code. It tests wParam directly. For WM_SYSCOMMAND uCmdType is wParam. Having used the code in several small applications, i have not actually HAD a problem with it, but it MAY cause a problem on other machines. Dont know. According to this it should test (wParam & 0xFFF0). thanks

Share this post


Link to post
Share on other sites