TIP: Click on subject to list as thread! ANSI
echo: os2prog
to: Mike Byrne
from: Gary Chambers
date: 1994-12-16 16:34:22
subject: KBD

Mike Byrne to All (Orig: 22:06, Mon, Dec 12, 1994):

 MB> Does anybody know how to change the repeat rate/delay of the
 MB> keyboard under OS/2 without using PM calls?

Your "PM calls" is a bit out of context.  You have to use
DosDevIOCtl to perform this feat.  Here's a bit of code (ala Borland style)
that will, hopefully, help you:

/* ------ >8 ------ */

#define INCL_NOPMAPI
#define INCL_DOSDEVICES
#define INCL_DOSDEVIOCTL

#include 
#include 

UCHAR main(VOID)
{
    RATEDELAY RateDelay;
    APIRET rc;
    HFILE hKeyboard;
    ULONG ulAction;

    RateDelay.usDelay = 500;  // 500 millisecond delay
    RateDelay.usRate = 10;   // 10 CPS repeat rate

//  According to the docs, if usRate is greater than the maximum rate, the
//  maximum rate is then used.

    rc = DosOpen("KBD$", &hKeyboard, &ulAction, 0L,
                 FILE_NORMAL,
                 OPEN_ACTION_CREATE_IF_NEW | OPEN_ACTION_OPEN_IF_EXISTS,
                 OPEN_ACCESS_WRITEONLY | OPEN_SHARE_DENYREADWRITE,
                 0L);
    if (rc)
    {
        printf("SYS%04X: DosOpen\n", rc);
        return(1); 
    }

    rc = DosDevIOCtl(hKeyboard, IOCTL_KEYBOARD, KBD_SETTYPAMATICRATE,
                     &RateDelay, sizeof(RateDelay), NULL, NULL, 0L,
                     NULL);
    if (rc)
    {
        printf("SYS%04X: DosDevIOCtl\n", rc);
        return(1);
    }

    DosClose(hKeyboard);

    return(0);
}

/* ------ 8< ------ */

GeeCee/2
Team OS/2 New England 
--- 
* Origin: Mystic Seaport Inn OiS/2 - USR DS V.34 - (207)721-3258 (1:326/426)
SEEN-BY: 12/2442 620/243 632/348 640/820 690/660 711/409 410 413 430 807 808
SEEN-BY: 711/809 934 942 949 712/353 515 713/888 800/1
@PATH: 326/426 411 400 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™.