keyspeed.c

来自「使用于OS/2下的小工具的C源程序,使用于OS/2下的小工具的C源程序」· C语言 代码 · 共 66 行

C
66
字号
/*
* KEYSPEED.C - Sets the keyboard typematic rate.
*
*
* PROGRAMMER:	    Martti Ylikoski
* CREATED:	    11.11.1991
*/
static char *VERSION = "Version  1.0. Copyright (c) Martti Ylikoski, 1991." ;
/*
*/

static char *progname ;

#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#define INCL_DOSDEVICES
#define INCL_DOSDEVIOCTL
#include <os2.h>


int main(int argc, char *argv[])
{
USHORT ret ;
RATEDELAY rdelay ;
USHORT delay, rate ;
HFILE keyb ;
USHORT action ;
   progname = argv[0] ;
   rdelay.usDelay = 30 ;
   rdelay.usRate = 50 ;

   if(argc == 3)
   {
      rdelay.usDelay = atoi(argv[1]) ;
      rdelay.usRate = atoi(argv[2]) ;
   }

   printf("%s - Sets the typematic rate of the keyboard\n", progname) ;
   puts("Sorry. There is now way the show the values in effect,") ;
   puts("because there is no function to retrive them (at least not documented)") ;
   puts(VERSION) ;
   printf("Usage: %s delay(milliseconds) rate(characters-per-second)\n", progname) ;

   if (argc != 3)
   {
      puts("Wrong number of arguments.") ;
      puts("Keyspeed not affected.") ;
      return( 1 ) ;
   }

   if ((ret = DosOpen("KBD$", &keyb, &action, 0L, FILE_NORMAL, FILE_OPEN,
      OPEN_ACCESS_READWRITE | OPEN_SHARE_DENYREADWRITE, 0L)) != 0)
   {
      printf("%s: error in DosOpen\n", progname) ;
      return( 1 ) ;
   }
   if ((ret = DosDevIOCtl(0L, &rdelay, 0x0054, 0x0004, keyb)) != 0)
   {
      printf("%s: error in DosDevIOCtl\n", progname) ;
      return( 1 ) ;
   }

   return( 0 ) ;
}

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?