TIP: Click on subject to list as thread! ANSI
echo: os2prog
to: Mike Byrne
from: Peter Fitzsimmons
date: 1994-12-15 23:46:06
subject: KBD

MB> Does anybody know how to change the repeat rate/delay

Here's an old 16bit program that still works great:

 /* Built using MSC 5.10 and the Microsoft Programmer's toolkit 1.10
  *
  * IBM toolkit owners will have to supply values for these constants,
  * which are not supplied in their 1.1 toolkit:
  *
  *  #define IOCTL_KEYBOARD         0x0004
  *  #define KBD_SETTYPAMATICRATE   0x0054
  *  typedef struct _RATEDELAY {
  *      USHORT usDelay;
  *      USHORT usRate;
  *  } RATEDELAY;
  *
  * P.Fitzsimmons.
  */

 #define INCL_NOPM           /* No pres man.*/
 #define INCL_DOS
 #define INCL_DOSDEVIOCTL
 #include 
 #include 
 #include 

 void cdecl main(int argc, char **argv)
 {
     RATEDELAY rd;
     USHORT rc, usAction;
     HFILE hf;

     if(argc != 3){
         printf("Usage:  TY  ");
         printf("\nWhere:\n\n");
         printf("Rate      Specifies the typamatic rate\n"            );
         printf("          (characters-per-second). A value greater\n");
         printf("          than the maximum value defaults to the\n"  );
         printf("          maximum value.\n"                          );
         printf("\n"                                                  );
         printf("Delay     Specifies the typamatic delay (in\n"       );
         printf("          milliseconds). A value greater than the\n" );
         printf("          maximum value defaults to the maximum\n"   );
         printf("          value.\n"                                  );
         printf("\nExample: TY 0 0\n");
         printf("Will set the keyboard to it's fastest response.\n");
         exit(0);
     }

     rc = DosOpen("KBD$", &hf, &usAction, 0L,
FILE_NORMAL, FILE_OPEN,
                   OPEN_ACCESS_READWRITE | OPEN_SHARE_DENYREADWRITE, 0L);
     if(rc){
         printf("Error 0x%04x from DosOpen(KBD$)\n", rc);
         exit(1);
     }

     rd.usRate = atoi(argv[1]);
     if(!rd.usRate)
         rd.usRate = 1000;
     rd.usDelay = atoi(argv[2]);
     rc = DosDevIOCtl(0L, &rd , KBD_SETTYPAMATICRATE, IOCTL_KEYBOARD, hf);
     if(rc){
         printf("Error 0x%04x from DosDevIOCtl()\n", rc);
         exit(1);
     }
     DosClose(hf);
     exit(0);
 }

If you've got a 16bit compiler kicking around (msc/watcom),  i'd suggest
leaving it (and any other such command line util) 16 bit,  as it will use
less disk space & ram.


--- Maximus/2 2.01
* Origin: Sol 3/Toronto (905)858-8488 (1:259/414)
SEEN-BY: 12/2442 620/243 624/50 632/348 640/820 690/660 711/409 410 413 430
SEEN-BY: 711/807 808 809 934 942 949 712/353 515 713/888 800/1
@PATH: 259/414 400 99 98 3615/50 229/2 12/2442 711/409 808 809 934

SOURCE: echomail via fidonet.ozzmosis.com

Email questions or comments to sysop@ipingthereforeiam.com
All parts of this website painstakingly hand-crafted in the U.S.A.!
IPTIA BBS/MUD/Terminal/Game Server List, © 2025 IPTIA Consulting™.