getAsyncKeyState

Syntax

int getAsyncKeyState (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 GetAsyncKeyState, and whether the key is currently up or down. If the most significant bit is set (ie is less than zero on a signed integer), the key is down, and if the least significant bit is set, the key was pressed after the previous call to GetAsyncKeyState.

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 down the CTRL key and click me",pos=(250,50),size=(150,15)


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

	}
	
	
	return false;
}

Also see

getAsyncKeyStateF, VK codes

Comments

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