Solved

Add "PrintScreen" to available hotkeys - how?

Posted on 2004-10-11
7
1,013 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 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
Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

 

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

Announcing the Most Valuable Experts of 2016

MVEs are more concerned with the satisfaction of those they help than with the considerable points they can earn. They are the types of people you feel privileged to call colleagues. Join us in honoring this amazing group of Experts.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
code issue 8 156
find a node in VST 2 73
TServerSocket - file via sendbuf or Text via sendtext ? 1 66
Create a path if not exists 7 92
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…
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…
Microsoft Active Directory, the widely used IT infrastructure, is known for its high risk of credential theft. The best way to test your Active Directory’s vulnerabilities to pass-the-ticket, pass-the-hash, privilege escalation, and malware attacks …

821 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