[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now

x
?
Solved

Add "PrintScreen" to available hotkeys - how?

Posted on 2004-10-11
7
Medium Priority
?
1,028 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
  • 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 800 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
What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

 

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 400 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

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!

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…
Hello everybody This Article will show you how to validate number with TEdit control, What's the TEdit control? TEdit is a standard Windows edit control on a form, it allows to user to write, read and copy/paste single line of text. Usua…
This lesson discusses how to use a Mainform + Subforms in Microsoft Access to find and enter data for payments on orders. The sample data comes from a custom shop that builds and sells movable storage structures that are delivered to your property. …
Screencast - Getting to Know the Pipeline
Suggested Courses
Course of the Month19 days, 15 hours left to enroll

873 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