Solved

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

Posted on 2006-11-29
9
437 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
[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
  • 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
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 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

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering 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

Suggested Solutions

Introduction The parallel port is a very commonly known port, it was widely used to connect a printer to the PC, if you look at the back of your computer, for those who don't have newer computers, there will be a port with 25 pins and a small print…
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…
Nobody understands Phishing better than an anti-spam company. That’s why we are providing Phishing Awareness Training to our customers. According to a report by Verizon, only 3% of targeted users report malicious emails to management. With compan…
In a recent question (https://www.experts-exchange.com/questions/29004105/Run-AutoHotkey-script-directly-from-Notepad.html) here at Experts Exchange, a member asked how to run an AutoHotkey script (.AHK) directly from Notepad++ (aka NPP). This video…

738 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