2.1.25.45 is_key_hit


Description

Check if user has hit a certain key like the ESC kay

Syntax

BOOL is_key_hit( int nKey = VK_ESCAPE, BOOL bRemove = true, int nKeyState = 0 )

Parameters

nKey
[input] virtual key code
bRemove
[input] to remove keys from message queue when the function is called, or false to keep keyboard messages in queue
nKeyState
[input] when key is pressed, check if ctrl, alt shift etc was also pressed if nKeyState > 0

Return

Examples

EX1

void kk()
{
    int nn = 0;
    while(nn < 1000000)
    {
        if(is_key_hit('C', true, VK_CONTROL))
            break;
        
        string str;
        str.Format("Ctrl-C to stop, cound = %d", nn++);
        SetDataDisplayText(str);
    }
    out_int("nn = ", nn);
}

Remark

See Also

Header to Include

origin.h

Reference