Solved

Trapping Windows button

Posted on 1998-01-26
8
208 Views
Last Modified: 2010-04-04
I am not sure if this is an easy task but:

how can i  trap the Windows button??

Regards
Keith
0
Comment
Question by:keithcsl
  • 5
  • 2
8 Comments
 
LVL 4

Expert Comment

by:d003303
ID: 1357565
Hum, Windows button ? Do you mean the minimize/maximize buttons on the title bar ?
0
 
LVL 8

Expert Comment

by:ZifNab
ID: 1357566
You mean the new windows button on the keyboard (win95 ,NT)?
0
 
LVL 8

Expert Comment

by:ZifNab
ID: 1357567
I believe, you have to check for the VK_LWin or VK_RWin key.
0
 
LVL 8

Accepted Solution

by:
ZifNab earned 20 total points
ID: 1357568
This should it be, if I correctly understood the question :

Use Plain form, copy this source to the unit, run it and push left or right window button on keyboard.

unit Unit1;

interface

uses
  Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
  StdCtrls, DtEdit97;

type
  TForm1 = class(TForm)
    procedure FormKeyDown(Sender: TObject; var Key: Word;
      Shift: TShiftState);
    procedure FormKeyPress(Sender: TObject; var Key: Char);
  private
    { Private declarations }
  public
    { Public declarations }
  end;

var
  Form1: TForm1;

implementation

{$R *.DFM}

procedure TForm1.FormKeyDown(Sender: TObject; var Key: Word;
  Shift: TShiftState);
  var i : integer;
begin
 If Key = VK_LWIn then showmessage('left');
 if key = vk_RWin then showmessage('right');
end;

end.

Regards,
ZifNab;
0
What Should I Do With This Threat Intelligence?

Are you wondering if you actually need threat intelligence? The answer is yes. We explain the basics for creating useful threat intelligence.

 
LVL 1

Author Comment

by:keithcsl
ID: 1357569
I am so soree but I meant the Windows key on the keyboard. Should have made my question more clearly..

Keith
0
 
LVL 8

Expert Comment

by:ZifNab
ID: 1357570
Keithcsl, the source code I gave you is meant for the windows key on the keyboard!!! The left and the right one!
0
 
LVL 1

Author Comment

by:keithcsl
ID: 1357571
ZifNab

Oh my, I am sorry for not reading your answer properly. The code works fine. Thanx!

If it is not too much to ask, is there a way to cancel the Keydown event?, ie i don't want the user to be able to press the Windows Key.

Thanx
Keith
0
 
LVL 8

Expert Comment

by:ZifNab
ID: 1357572
Hi Keith,
I don't know really, it seems that the key is directely sended to windows. You can't just assign another value to Key as normally. I'll try to find a solution, but I can't promise anything.
0

Featured Post

Why You Should Analyze Threat Actor TTPs

After years of analyzing threat actor behavior, it’s become clear that at any given time there are specific tactics, techniques, and procedures (TTPs) that are particularly prevalent. By analyzing and understanding these TTPs, you can dramatically enhance your security program.

Join & Write a Comment

Suggested Solutions

A lot of questions regard threads in Delphi.   One of the more specific questions is how to show progress of the thread.   Updating a progressbar from inside a thread is a mistake. A solution to this would be to send a synchronized message to the…
Introduction The parallel port is a very commonly known port, it was widely used to connect a printer to the PC, if you look at the back of your computer, for those who don't have newer computers, there will be a port with 25 pins and a small print…
Excel styles will make formatting consistent and let you apply and change formatting faster. In this tutorial, you'll learn how to use Excel's built-in styles, how to modify styles, and how to create your own. You'll also learn how to use your custo…
Polish reports in Access so they look terrific. Take yourself to another level. Equations, Back Color, Alternate Back Color. Write easy VBA Code. Tighten space to use less pages. Launch report from a menu, considering criteria only when it is filled…

758 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

24 Experts available now in Live!

Get 1:1 Help Now