Category : OS/2 Files
Archive   : SPDKEY.ZIP
Filename : SPEEDKEY.C

 
Output of file : SPEEDKEY.C contained in archive : SPDKEY.ZIP

/*------------------------------------------------------------------
SPEEDKEY - Set typamatic rate in OS/2, (c) 1989, Charles Petzold
------------------------------------------------------------------*/

#define INCL_DOSDEVICES
#define INCL_DOSDEVIOCTL
#include
#include

int main (int argc, char *argv[])
{
static CHAR achMessage[] = "Syntax: SPEEDKEY delay(msec) rate(cps)" ;
RATEDELAY rtdly ;
USHORT hKbd, usAction ;

if (argc < 3)
{
DosWrite (2, achMessage, sizeof (achMessage) - 1, &usAction) ;
return 1 ;
}

rtdly.usDelay = atoi (argv[1]) ;
rtdly.usRate = atoi (argv[2]) ;

DosOpen ("kbd$", &hKbd, &usAction, 0L, 0,
FILE_OPEN, OPEN_SHARE_DENYNONE, 0L) ;

DosDevIOCtl (NULL, &rtdly, KBD_SETTYPAMATICRATE, IOCTL_KEYBOARD, hKbd) ;

DosClose (hKbd) ;
return 0 ;
}