Solved

Add "PrintScreen" to available hotkeys - how?

Posted on 2004-10-11
7
1,020 Views
Last Modified: 2010-05-18
Hello, all,
problem: I'm writing some sort of advanced printscreen application. This, itself, is not a problem; problem is, that I'd like to provide possibility to provide _configurable_ hot key for this task, and it should include 'PrintScreen' as well. For example, if user hits Ctrl+PrintScreen, this combination is displayed in THotKey box and can be assigned to hotkey or shortcut (currently I'm using TfisHotKey component). It does not happen, seems, that application does not even receive printscreen key.

I did some Google'ing and found a sample, how to register and trap PrintScreen in the application along with modifiers, but how to add PrintScreen to normal hot key processing?

I'm trying to get this done in Delphi 5, if it is important.

Best regards and thanks in advance,
  W_Fox

p.s. I just hope, that question is understandable :).
0
Comment
Question by:W_Fox
[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
  • 3
  • 3
7 Comments
 
LVL 6

Expert Comment

by:vadim_ti
ID: 12282245
if i understood your question,

to receive Ctrl+PrintScreen
you need to assign VK_SNAPSHOT+$4000 to key property of TfisHotKey component

0
 

Author Comment

by:W_Fox
ID: 12284550
vadim_ti,
half of work done, thanks. Now the tricky part - how to provide possibility to configure this using THotKey component (or other, freeware, if there's some) - including displaying of shortcut text? User should be able to change this as well, and he/she even might want to override default PrtScr or Alt-PrtScr functionality, or assign these keys to perform another actions.

Regards,
  W_Fox
0
 
LVL 6

Accepted Solution

by:
vadim_ti earned 200 total points
ID: 12286624
ok, lets say you want to give ti user opportunity to select hotkey
between "F1",.."F9", printScreen , ctrl+PrntScreen

at setup stage
register with TFisHotKey
printScreen and ctrl+PrintScreen with Event=ForSelectEvent.

if user hit F1 - F9 you will get it on regular KeyDown event and display Key Name
if user hit printScreen or ctrl+prntScreen you will catch it via TFisHotKey event handler and display KeyName

after user selecting done you will unregiter printScreen and ctrl+PrintScreen with ForSelectEvent

and register selected key (it can be F1-F9, PrintScreen etc) with TFisHotKey with Event = RealHotActionEvent

I hope you understand me, even with my bad english

Regards,
Vadim
0
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!

 

Author Comment

by:W_Fox
ID: 12300341
Hi,
sorry for long silence.

This is not exactly what I was looking for :(. The best would be to alter menus.pas and comctrls.pas (these two seem to be responsible for THotKey and TShortCut) to implement usage of PrintScreen, so, it would behave like any other key => one solution for all important events in life :). Is it possible? If it is - I'd like to know, how :)

Regards,
  W_Fox
_______________________________
0
 
LVL 14

Assisted Solution

by:DragonSlayer
DragonSlayer earned 100 total points
ID: 12300577
wat about... during runtime:

MenuItem1.ShortCut := ShortCut(VK_SNAPSHOT, []);

that would register the PrintScreen key to the menuitem, I believe?

Similarly, while the THotKey is active, and you can hook the PrintScreen key (since you mentioned you read a few articles on how to trap the key), and if it is pressed, assign it to the THotKey component via HotKey1.HotKey := ShortCut(VK_SNAPSHOT, [ ]);
0
 
LVL 6

Expert Comment

by:vadim_ti
ID: 12302379
i think it is never good to change menus.pas or comctrls.pas because maintenance problems
(delphi updates, new version or even reinstall delphi on your computer, impossibilte to work with
runtime packages and so on)
0
 

Author Comment

by:W_Fox
ID: 12433956
Hello,
sorry for long silence - deadlines were coming [and project in question was not related to them :)].

So, I didn't completely got the solution I was looking for, but vadim_ti and DragonSlayer, I believe that both your comments will be helpful, when I get time to use them :).

Thanks,
  W_Fox
0

Featured Post

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

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

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…
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…
NetCrunch network monitor is a highly extensive platform for network monitoring and alert generation. In this video you'll see a live demo of NetCrunch with most notable features explained in a walk-through manner. You'll also get to know the philos…
If you’ve ever visited a web page and noticed a cool font that you really liked the look of, but couldn’t figure out which font it was so that you could use it for your own work, then this video is for you! In this Micro Tutorial, you'll learn yo…

724 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