[Webinar] Learn how to a build a cloud-first strategyRegister Now

x
?
Solved

How i check if CTRL key is pressed when i click on a Button?

Posted on 2004-08-16
2
Medium Priority
?
220 Views
Last Modified: 2010-04-05

I´d like to check if CTRL key is pressed when i click on a Button. Do you know how i implement this?

Best Regards.
0
Comment
Question by:joelsilva
2 Comments
 
LVL 3

Accepted Solution

by:
Tyrsis earned 100 total points
ID: 11817575
Here you go:

unit Unit1;

interface

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

type
  TForm1 = class(TForm)
    Button1: TButton;
    Memo1: TMemo;
    procedure Button1Click(Sender: TObject);
  private
    { Private declarations }
  public
    { Public declarations }
  end;

var
  Form1: TForm1;

implementation

{$R *.dfm}

procedure TForm1.Button1Click(Sender: TObject);
var
    iState : SmallInt;
begin
    if(GetKeyState(VK_CONTROL) < 0) then
    begin
        Memo1.Lines.Add('Control Key Pressed');
    end
    else
    begin
        Memo1.Lines.Add('Control Key NOT Pressed');
    end;
end;

end.
0
 

Author Comment

by:joelsilva
ID: 11817601
Thanks very much... I appreciate so much your answer.
0

Featured Post

Technology Partners: 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

Introduction I have seen many questions in this Delphi topic area where queries in threads are needed or suggested. I know bumped into a similar need. This article will address some of the concepts when dealing with a multithreaded delphi database…
Introduction Raise your hands if you were as upset with FireMonkey as I was when I discovered that there was no TListview.  I use TListView in almost all of my applications I've written, and I was not going to compromise by resorting to TStringGrid…
This Micro Tutorial will teach you how to add a cinematic look to any film or video out there. There are very few simple steps that you will follow to do so. This will be demonstrated using Adobe Premiere Pro CS6.
Are you ready to place your question in front of subject-matter experts for more timely responses? With the release of Priority Question, Premium Members, Team Accounts and Qualified Experts can now identify the emergent level of their issue, signal…
Suggested Courses
Course of the Month20 days, 11 hours left to enroll

865 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