| TIP: Click on subject to list as thread! | ANSI |
| echo: | |
|---|---|
| to: | |
| from: | |
| date: | |
| subject: | Possible to trap Ctrl-Alt-Del or NumLock? |
KB> Is there any way to trap the Ctrl-Alt-Del key sequence? This is
Yes, the following code will do it. Of course, although OS/2 handles CAD
quite well, there could be many application-specific reasons why this would
be desirable. I can imagine scenarios involving real time process control,
monitoring, security and many more. Assuming that the system cabinet is
secured and locked-away, a redundant power supply has been isolated and
backed up on an UPS, and for application-specific reasons (not to mention
security, as it may be in a public area) ... you simply cannot have anyone
casually walking by the keyboard and offering a three finger salute. We're
talking a very sophisticated turnkey application here, not your simple
shareware mail reader.
Anyway, FWIW the following code was snipped from the FidoNet OS2PROG echo
on 6/1/93, in a response to Kenneth Roach who had the exact concerns listed
above. The code works as a toggle. If you run the code once, it will
disable CAD. If you run it again, it will enable CAD. As an extra bonus, it
will also dump your session manager hot keys.
Originally posted here by Kim Kruse Hansen, I've compiled and tested this
with Watcom v10.
---------8<------------Cut-Here----------------8<-------------
#define INCL_DOS
#include
#include
#include
#include
#include
#pragma pack(1)
typedef struct _SESMGRHOTKEY
{
USHORT State;
UCHAR Make;
UCHAR Break;
USHORT Hot;
} SESMGRHOTKEY, *PSESMGRHOTKEY;
#pragma pack()
HFILE hRead;
ULONG OpenKBD()
{
ULONG lastrc;
PCHAR fname="KBD$";
ULONG action=0;
ULONG filesize=0;
ULONG fileattributes=FILE_NORMAL;
ULONG openflag=OPEN_ACTION_FAIL_IF_NEW | OPEN_ACTION_OPEN_IF_EXISTS;
ULONG openmode=OPEN_SHARE_DENYNONE | OPEN_ACCESS_READWRITE;
PEAOP2 eabuf=NULL;
lastrc=DosOpen(fname,
&hRead,
&action, // action if open ok
filesize, // file size
fileattributes, // file attributes (if created)
openflag, //
openmode , // sharingmode
eabuf); // ea buffer,
return lastrc;
}
void DumpKeys(PSESMGRHOTKEY pKey,ULONG ulCnt)
{
ULONG f;
for (f=0;f * Origin: River of Swans, an OS/2 BBS * (913) 242-1204 * (1:2801/20)SEEN-BY: 12/2442 54/54 620/243 624/50 632/348 640/820 690/660 711/409 410 413 SEEN-BY: 711/430 807 808 809 934 712/353 623 713/888 800/1 @PATH: 2801/1 280/1 396/1 3615/50 229/2 12/2442 711/409 54/54 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™.