Solved

Trapping Windows button

Posted on 1998-01-26
8
213 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
Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
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
 
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

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Have you ever had your Delphi form/application just hanging while waiting for data to load? This is the article to read if you want to learn some things about adding threads for data loading in the background. First, I'll setup a general applica…
In my programming career I have only very rarely run into situations where operator overloading would be of any use in my work.  Normally those situations involved math with either overly large numbers (hundreds of thousands of digits or accuracy re…
With Secure Portal Encryption, the recipient is sent a link to their email address directing them to the email laundry delivery page. From there, the recipient will be required to enter a user name and password to enter the page. Once the recipient …

713 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