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

x
?
Solved

WM_keydown-question

Posted on 2006-05-16
2
Medium Priority
?
221 Views
Last Modified: 2010-04-05
Hi,

If the user presses the shift-button it has to do 2 things
put a variable in fLastAlt : char en execute a procedure called CapsOff
How can i do that?

Private
fLastAlt: char ;

procedure TDSP3270.WMKeyDown(var Msg: TWMKeyDown);
begin

   if (fKbdLocked)and(Msg.CharCode<>vk_escape) then
   LockKeyBoard('?+    ',ALARM);

  case Msg.CharCode of
   vk_up      : CursorUp(1);
   vk_down    : CursorDown(1);
   vk_left    : Cursorleft(1);
   vk_right   : CursorRight(1);
   vk_home    : CursorHome;
   vk_prior   : AlterCursor;
   vk_insert  : InsertOn;
   vk_escape  : reset;
   vk_capital : CapsOn;
   vk_menu    : Nothing;
   vk_delete  : DeleteCh;
   vk_shift   : fLastAlt := 'C'//and CapsOff;
   end;
end;

Greetz,

Peter
0
Comment
Question by:peterkiers
2 Comments
 
LVL 28

Accepted Solution

by:
2266180 earned 1000 total points
ID: 16689098
unit Unit1;

interface

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

type
  TForm1 = class(TForm)
    Label1: TLabel;
    Label2: TLabel;
  private
    { Private declarations }
    fLastAlt: char ;
  public
    { Public declarations }
    procedure WMKeyDown(var Msg: TWMKeyDown); message WM_KEYDOWN;
  end;

var
  Form1: TForm1;

implementation

{$R *.dfm}

procedure TForm1.WMKeyDown(var Msg: TWMKeyDown);
begin
  label1.caption:=IntToHex(msg.charcode,4);
  case Msg.CharCode of
    vk_shift   : begin
                   fLastAlt := 'C';//and CapsOff
                   label2.caption:='shift pressed';// replace this with the call to capsoff;
                 end;
  end;
end;

end.

run the above program and you will see it execute fine :)
0
 
LVL 1

Author Comment

by:peterkiers
ID: 16689146
Thanx,

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

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…
Objective: - This article will help user in how to convert their numeric value become words. How to use 1. You can copy this code in your Unit as function 2. than you can perform your function by type this code The Code   (CODE) The Im…
When cloud platforms entered the scene, users and companies jumped on board to take advantage of the many benefits, like the ability to work and connect with company information from various locations. What many didn't foresee was the increased risk…
Whether it be Exchange Server Crash Issues, Dirty Shutdown Errors or Failed to mount error, Stellar Phoenix Mailbox Exchange Recovery has always got your back. With the help of its easy to understand user interface and 3 simple steps recovery proced…
Suggested Courses
Course of the Month18 days, 2 hours left to enroll

830 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