Link to home
Start Free TrialLog in
Avatar of Sadam
Sadam

asked on

Simple one... you think? - for the experts.

I kinda asked this before, but now I really need the answer.

I need some source, small and simple, in Visual C or Delphi, that runs on Windows 2000, that disables the Windows key.

Thanks in advance.
Avatar of afzalj
afzalj

Bit short for time, but you could:
hook the keyboard using SetWindowsHookEx(WH_KEYBOARD, ......),
and scan for the keycode for the windows-key ?
Avatar of Sadam

ASKER

I started out that way.

First of all you use WH_KEYBOARD_LL and not WH_KEYBOARD.

Didn't work out too well though.

I managed to hook the Windows key and stop windows from seeing it, but the key doesn't release. Therefor any key I press after that becomes a combination of the Windows key and that new key.

This must be the right way to do it, but I need some help... some source.

-out.
Avatar of jkr
A quick&dirty solution would be

char c;
// disable key
SystemParametersInfo ( SPI_SCREENSAVERRUNNING, 1, (void*) &c, 0);

char c;
// enable key
SystemParametersInfo ( SPI_SCREENSAVERRUNNING, 0, (void*) &c, 0);

(haven't tried it on Win2k)
Avatar of Sadam

ASKER

jkr.

In my opinion it should be the sollution, but MS removed it in windows 2000.

My guess is, to keep a stable OS.
Now any key pressed on a screen saver just returns you to the login screen.

So... Unfortunately it doesn't work on 2000.

-out.
ASKER CERTIFIED SOLUTION
Avatar of waseemanis
waseemanis

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of Sadam

ASKER

Sorry I only comment now.
I've been very busy lately...

I tried a quick test this morning on the PreTranslateMessage, but can't get it to work.

Could you send me some source please.
Just a Hello World.

Thanks.

-out.
Avatar of Sadam

ASKER

Waseemanis...

You got some code for me please???

I need it urgently.

-out.