Archived

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

Syntax question and question about GetAsyncKeyState

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

I have seen people do like this:
if (::GetAsyncKeyState('B') & 0x8000f)  
Why not just
if (::GetAsyncKeyState('B'))  
? The second question is about syntax. In a sample chapter from Modern C++ Design I saw this code:
template <template <class> class CreationPolicy>
class WidgetManager : public CreationPolicy<Widget>
{
    ...
    void DoSomething()
    {
        Gadget* pW = CreationPolicy<Gadget>().Create();
    ...
    }
};
Why does he write:
template <template <class> class CreationPolicy>  
? [edited by - Eriond on March 24, 2004 10:22:33 AM]

Share this post


Link to post
Share on other sites
To answer your first question, GetAsyncKeyState returns information on a given key on a the keyboard as a series of flags in a 32-bit integer. It just so happens that 0x8000 is the bit which checks wether the key is down or not. Since this is generally what we want to know when we use GetAsyncKeyState, I''m pretty sure you can deduce the answer to your question now.

Share this post


Link to post
Share on other sites