getAsyncKeyStateF

Syntax

int fm_getAsyncKeyStateF (int vkey)

Arguments

vkey
Virtual Key Constant. For more information see the [MSDN]

Return

The return value specifies whether the key was pressed since the last call to a member of the getAsyncKeyState family of functions, and whether the key is currently up or down. If the most significant bit is set, the key is down, and if the least significant bit is set, the key was pressed after the previous call to GetAsyncKeyState.
getAsyncKeyStateF also checks if the window is currently active. If not, all keys will be seen as "up" (that is; not pressed).

Description

Determines whether a key is up or down at the time the function is called, and whether the key was pressed after a previous call to getAsyncKeyState.

Example

%ffp

ctl(10): pushbutton, Text="Hold own the CTRL key and click me", 
    pos = (250, 50), size = (150, 15)


OnCtl(n): 
{
  int r;
  if (n == 10 && e == FME_CLICKED)  
  {		
    if (getAsyncKeyStateF(VK_CONTROL) < 0)
	Info ("The Control Key was just pressed.");	
    else
	ErrorOk ("You didn't press the Control Key.");	
  }	
  return false;
}

Also see

FME_KEYDOWN, FME_KEYUP, getAsyncKeyState, VK codes

Comments

Everyone can add his comments about his experiences with this function here. Tips for using it are welcome, too.