Board index » delphi » trapping CTRL-ESC, CTRL-ALT-DEL in win95?

trapping CTRL-ESC, CTRL-ALT-DEL in win95?

I've been trying to no avail to trap the CTRL-ESC and CTRL-ALT-DEL keys
in win 95 using delphi 2.0. Windows appears to be taking control no
matter what I try. Is there something that must be done to tell windows
to back off or am I missing some peice of the puzzle?

-Pierre

btw: What I am doing is using the OnKeyDown of the form to handle the
"trap" .

 

Re:trapping CTRL-ESC, CTRL-ALT-DEL in win95?


Quote
Pierre Sopel wrote:

> I've been trying to no avail to trap the CTRL-ESC and CTRL-ALT-DEL keys
> in win 95 using delphi 2.0. Windows appears to be taking control no
> matter what I try. Is there something that must be done to tell windows
> to back off or am I missing some peice of the puzzle?

> -Pierre

> btw: What I am doing is using the OnKeyDown of the form to handle the
> "trap" .

I think you will find that these key strokes are intercepted by the Windows
IO messaging system before they make it into your application message queue.

Before anyone suggest a global keyboard/message hook, I don't think that
will work either.  My understanding is that global hooks intercept the
message stream *after* they have been dealt with by the system handler, and
simply allow you to be the first to deal with them when they enter the
global application message queue prior to despatch to the individual
application queues.

As a result, I think the only way to intercept these messages is to implement
a VXD to grab them and either deal with them or echo them up the line as
application messages.

I am willing to be corrected on this, since this view of how things
operate is a combination of observation (global hooks in 3.x don't get these
messages either) and scant knowledge of Windows and other multi-tasking OS's
and how they deal with such things.

Of course, other OS's allow you to intercept the system message queue far more
elegantly (Commodity applications under Exec/Intuition for example), but that's
another story...

Hope this helps.

--
Jolyon Smith                         |  The views represented above are my own
Application Development Consultant   |  and do not necessarily represent the
PLATINUM Solutions (UK)              |  views of my employer.

Re:trapping CTRL-ESC, CTRL-ALT-DEL in win95?


.> I've been trying to no avail to trap the CTRL-ESC and CTRL-ALT-DEL keys
.> in win 95 using delphi 2.0. Windows appears to be taking control no
.> matter what I try. Is there something that must be done to tell windows
.> to back off or am I missing some peice of the puzzle?
.
.I think you will find that these key strokes are intercepted by the Windows
.IO messaging system before they make it into your application message queue
.
.Before anyone suggest a global keyboard/message hook, I don't think that
.will work either.  My understanding is that global hooks intercept the
.message stream *after* they have been dealt with by the system handler, and
.simply allow you to be the first to deal with them when they enter the
.global application message queue prior to despatch to the individual
.application queues.
.
.As a result, I think the only way to intercept these messages is to implement
.a VXD to grab them and either deal with them or echo them up the line as
.application messages.

You are exactly right...  Fortunately, I've already written such a
VxD.  You can download the demo (KeyBlock), if you're interested, at
http://members.aol.com/phord

Phil

Re:trapping CTRL-ESC, CTRL-ALT-DEL in win95?


Quote
ps_s...@alcor.concordia.ca (Pierre Sopel) wrote:
>I've been trying to no avail to trap the CTRL-ESC and CTRL-ALT-DEL keys
>in win 95 using delphi 2.0. Windows appears to be taking control no
>matter what I try. Is there something that must be done to tell windows
>to back off or am I missing some peice of the puzzle?
>-Pierre
>btw: What I am doing is using the OnKeyDown of the form to handle the
>"trap" .

I don't know if the following works:

procedure TurnSysKeysOff;
var
  OldVal : LongInt;
begin
  SystemParametersInfo (97, Word (True), @OldVal, 0);
end;

when you call this procedure all Windows95 system keys are turned off.
Windows95 will not respond to ALT-TAB, CTRL-ESC, ALT-ESC, CTRL-ALT-DEL
or so.

You may then be able to intercept these keys (maybe you get a keydown
event then or maybe you have to intercept the WM_SYSKEYDOWN msg).

But remember to call the following procedure after your program
execution:

procedure TurnSysKeysOff;
var
  OldVal : LongInt;
begin
  SystemParametersInfo (97, Word (False), @OldVal, 0);
end;

Or your windows will be a bit unusable if your program does not any
more run and all these keys are not working any more <g>.

Hope this helps

Meik Weber
m.we...@public.ndh.com or
100744.3...@compuserve.com

Other Threads