Solved

Trapping Windows button

Posted on 1998-01-26
8
215 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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
Industry Leaders: 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

Industry Leaders: 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!

Question has a verified solution.

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

In this tutorial I will show you how to use the Windows Speech API in Delphi. I will only cover basic functions such as text to speech and controlling the speed of the speech. SAPI Installation First you need to install the SAPI type library, th…
Hello everybody This Article will show you how to validate number with TEdit control, What's the TEdit control? TEdit is a standard Windows edit control on a form, it allows to user to write, read and copy/paste single line of text. Usua…
This is a high-level webinar that covers the history of enterprise open source database use. It addresses both the advantages companies see in using open source database technologies, as well as the fears and reservations they might have. In this…
There are cases when e.g. an IT administrator wants to have full access and view into selected mailboxes on Exchange server, directly from his own email account in Outlook or Outlook Web Access. This proves useful when for example administrator want…

696 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