• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Checking if a modifier key is pressed
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Checking if a modifier key is pressed


  • Subject: Re: Checking if a modifier key is pressed
  • From: Stéphane Sudre <email@hidden>
  • Date: Mon, 4 Aug 2003 14:32:22 +0200

On lundi, ao{ 4, 2003, at 14:28 Europe/Paris, Jesus De Meyer wrote:

Hi,

I would like to check if a modifier key is pressed before I continue with a certain method. Normally this would be done inside the keyDown method, but I'm not using that.

Thanks in advance
_______________________________________________

#include <Carbon/Carbon.h>

// Various Key Codes

#define KeyShift 0x38
#define KeyControl 0x3b
#define KeyOption 0x3A
#define KeyCommand 0x37
#define KeyCapsLock 0x39
#define KeySpace 0x31
#define KeyTabs 0x30

int IsKeyPressed(unsigned short);

int IsKeyPressed(unsigned short key)
{
unsigned char km[16];

GetKeys((unsigned long *)km);
return ((km[key>>3] >> (key & 7)) & 1) ? 1 : 0;
}
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.

References: 
 >Checking if a modifier key is pressed (From: Jesus De Meyer <email@hidden>)

  • Prev by Date: Checking if a modifier key is pressed
  • Next by Date: QuickTime stops to play
  • Previous by thread: Checking if a modifier key is pressed
  • Next by thread: Re: Checking if a modifier key is pressed
  • Index(es):
    • Date
    • Thread