[Last Call] Learn about multicloud storage options and how to improve your company's cloud strategy. Register Now

x
?
Solved

Using GetKeys

Posted on 1997-01-04
1
Medium Priority
?
339 Views
Last Modified: 2013-12-26
I need to know how to use GetKeys in a program made in C. How can I get individual keys? Useualy It just returns them all mixed up. ie:1 0 0 0 0 0 0 0 would be 8 elements of an aray.10000000 is how it gets returned. 8 bits instead of 8 elements.
0
Comment
Question by:simap
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
1 Comment
 

Accepted Solution

by:
gregj earned 200 total points
ID: 1291753
Usually what you need from GetKeys is to find out if a specific key is pressed. You need the key scan code, which are documented in Inside Macintosh (Event Manager) and Think Reference.

There is a complete explanation of the keymap structure in Inside Macintosh.

This function is what I and most everyone else uses:



Boolean IsKeyDown(unsigned short scancode )
{
      unsigned char keymap[16];

      GetKeys( (long *) keymap);
      return ( ( keymap[scancode>>3] >> (scancode & 7) ) & 1);
}


0

Featured Post

Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

In this article, I'll describe -- and show pictures of -- some of the significant additions that have been made available to programmers in the MFC Feature Pack for Visual C++ 2008.  These same feature are in the MFC libraries that come with Visual …
In this post we will learn different types of Android Layout and some basics of an Android App.
This video will show you how to get GIT to work in Eclipse.   It will walk you through how to install the EGit plugin in eclipse and how to checkout an existing repository.
Sometimes it takes a new vantage point, apart from our everyday security practices, to truly see our Active Directory (AD) vulnerabilities. We get used to implementing the same techniques and checking the same areas for a breach. This pattern can re…

650 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question