Add "PrintScreen" to available hotkeys - how?

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 :).
W_FoxAsked:
Who is Participating?
 
vadim_tiConnect With a Mentor Commented:
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
 
vadim_tiCommented:
if i understood your question,

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

0
 
W_FoxAuthor Commented:
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
[Webinar] Improve your customer journey

A positive customer journey is important in attracting and retaining business. To improve this experience, you can use Google Maps APIs to increase checkout conversions, boost user engagement, and optimize order fulfillment. Learn how in this webinar presented by Dito.

 
W_FoxAuthor Commented:
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
 
DragonSlayerConnect With a Mentor Commented:
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
 
vadim_tiCommented:
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
 
W_FoxAuthor Commented:
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
All Courses

From novice to tech pro — start learning today.