Solved

How can I get ctrl + F10 pressed in my application?

Posted on 2006-11-29
9
433 Views
Last Modified: 2010-04-05
Hello guys,

I drop this component ApplicationEvents and I need to catch ctrl + F10 when user press in any part of my application,

How can I do this with applicationEvents?

crtl + F10

thanks
0
Comment
Question by:hidrau
  • 5
  • 4
9 Comments
 
LVL 28

Expert Comment

by:2266180
ID: 18036508
well, there is this issue with the F10 since it's being used to activate the form menu (similar with alt key).

see the following code:
procedure TForm1.ApplicationEvents1Message(var Msg: tagMSG;
  var Handled: Boolean);
begin
  if (msg.message=WM_KEYUP) and (KeyboardStateToShiftState=[ssctrl]) and (msg.wParam=VK_F10) then
    showmessage('ctrl+F10 pressed');
end;

procedure TForm1.FormKeyUp(Sender: TObject; var Key: Word;
  Shift: TShiftState);
begin
  if (key=vk_f10) and (ssctrl in shift) then
    showmessage('1');
end;

the onkeyup event works fine.
the applicationevents will not work for F10 but will work just fine fo other keys. that is because pressing F10 will not fire teh application events. setting the form keypreview to true doesn't fix it either.

so there is a workaround without using the applicationevents. is this ok for you?
0
 
LVL 1

Author Comment

by:hidrau
ID: 18036569
weird that I tested this code and nothing happened

procedure TForm1.ApplicationEvents1Message(var Msg: tagMSG;
  var Handled: Boolean);
begin
  if (msg.message=WM_KEYUP) and (KeyboardStateToShiftState=[ssctrl]) and (msg.wParam=VK_F10) then
    showmessage('ctrl+F10 pressed');
end;

are you sure about that?
0
 
LVL 1

Author Comment

by:hidrau
ID: 18036584
What does this "handled : Boolean" in the function serve for?

0
Ransomware: The New Cyber Threat & How to Stop It

This infographic explains ransomware, type of malware that blocks access to your files or your systems and holds them hostage until a ransom is paid. It also examines the different types of ransomware and explains what you can do to thwart this sinister online threat.  

 
LVL 1

Author Comment

by:hidrau
ID: 18036608
I tested without this (msg.message=WM_KEYUP) and worked, but it repeated twice the showmessage.

Is this the reason for using this part of the code?

0
 
LVL 28

Accepted Solution

by:
2266180 earned 500 total points
ID: 18036626
you did not read my entire message.
so,  "the applicationevents will not work for F10 but will work just fine fo other keys". so I never said that it works like that, but that it works with otehr keys.

now I thought a little since you mentioned that the message appeared and looked at what message does that and if you change it to:

procedure TForm1.ApplicationEvents1Message(var Msg: tagMSG;
  var Handled: Boolean);
begin
  if (msg.message=WM_SYSKEYUP) and (KeyboardStateToShiftState=[ssctrl]) and (msg.wParam=VK_F10) then
    showmessage('ctrl+F10 pressed');
end;

it will work. I forgot that there is that message for the system keys :D
0
 
LVL 1

Author Comment

by:hidrau
ID: 18036640
ok, I misunderstood your post  

I will replace F10 to F12 :))
thanks
0
 
LVL 28

Expert Comment

by:2266180
ID: 18036657
no need to. I gave a working solution for F10 just now
0
 
LVL 28

Expert Comment

by:2266180
ID: 18036660
I changed
if (msg.message=WM_KEYUP)
to
if (msg.message=WM_SYSKEYUP)

in case you missed the change ;)
0
 
LVL 1

Author Comment

by:hidrau
ID: 18036664
with (msg.message=WM_SYSKEYUP) , right, because I tested and it worked fine :)))
0

Featured Post

Use Case: Protecting a Hybrid Cloud Infrastructure

Microsoft Azure is rapidly becoming the norm in dynamic IT environments. This document describes the challenges that organizations face when protecting data in a hybrid cloud IT environment and presents a use case to demonstrate how Acronis Backup protects all data.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Delphi selector screen 2 80
TEMBEDDEDWB how can i change its user agent ? 8 58
tvirtualstringtree freeze when load too manny images 10 63
Multi-layered image in FireMonkey 9 39
The uses clause is one of those things that just tends to grow and grow. Most of the time this is in the main form, as it's from this form that all others are called. If you have a big application (including many forms), the uses clause in the in…
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…
This Micro Tutorial will teach you how to censor certain areas of your screen. The example in this video will show a little boy's face being blurred. This will be demonstrated using Adobe Premiere Pro CS6.
Established in 1997, Technology Architects has become one of the most reputable technology solutions companies in the country. TA have been providing businesses with cost effective state-of-the-art solutions and unparalleled service that is designed…

831 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