TIP: Click on subject to list as thread! ANSI
echo: os2prog
to: All
from: Gary Chambers
date: 1996-02-17 18:46:20
subject: Kbd DosDevIOCtl Restrictions in PM

Hi All...

Are there any restrictions to calling Keyboard IOCtl functions in PM?  I
wrote a *VERY* simple utility (non-functioning at the moment) to toggle the
state of the xLock keys by using Checkmark Buttons.  The dialog window
(sorry, Peter) functions properly, and the messages are received correctly,
but the IOCtls are blowing the state of the keyboard (e.g. when the program
is exited, even if Caps Lock was returned to it's original state, it still
acts as if a SHIFT LOCK was in effect).  In full-screen, text mode, they
work (an example follows):

#define SCROLL 0x10
#define NUMBER 0x20
#define CAPS   0x40

typedef struct _xLOCK
{
    USHORT ShiftState;
    BYTE   NLS;
} XLOCK;

APIRET LedSetScrollLock(HFILE hkbd, BOOL State)
{
    XLOCK xl;
    APIRET rc;

    if (State)
        xl.ShiftState = SCROLL;

    rc = DosDevIOCtl(hkbd, IOCTL_KEYBOARD, KBD_SETSHIFTSTATE,
                     &xl, sizeof(XLOCK), NULL, NULL, 0L,
                     NULL);
    return(rc);
}

Any advice?

GeeCee/2
gchambers{at}maine.com

... Topsham, ME 43 57.0'N 69 57.0'W 
--- 
* Origin: Mystic Seaport Inn OiS/2 - USR DS V.34+ - (207)721-3258 (1:326/426)
SEEN-BY: 50/99 78/0 270/101 620/243 711/401 409 410 413 430 808 809 934 955
SEEN-BY: 712/407 515 517 628 713/888 800/1 7877/2809
@PATH: 326/426 411 400 3615/50 396/1 270/101 712/515 711/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™.