?
Solved

How to get CHotKeyCtrl text?

Posted on 1998-10-15
6
Medium Priority
?
257 Views
Last Modified: 2013-11-20
I want to show in my app title hotkey text (for example "Ctrl+F12") but could not obtain it from CHotKeyCtrl. How can i do this?
0
Comment
Question by:mikle081198
6 Comments
 
LVL 8

Expert Comment

by:Answers2000
ID: 1323326
CHotKeyCtrl lets the user select a hot key - it isn't to find out background info for your app (e.g. hot key used to start it) - it sounds a bit like you may have misunderstood what this class is for ?

to get the text from a hot key control using the GetWindowText member

CString strText ;
m_hotKey.GetWindowText( strText ) ;

CHotKeyCtrl derives off CWnd, so all the CWnd members exist for it too...(such as GetWindowText)
0
 

Author Comment

by:mikle081198
ID: 1323327
Unfortunately neither GetWindowText nor DetDlgItemText does not work. :(
0
 
LVL 2

Expert Comment

by:prasanth
ID: 1323328
If GetWindowText doesn't work, then probably you can't get the text from it (HotKey is probably using an internal variable to store the text rather then the window text). But what you can do is get the virtual key code using GetHotKey and interpret it yourself to generate the caption text.
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!

 

Author Comment

by:mikle081198
ID: 1323329
Yes i can do it but i'm searching more direct method, without interpreting hotkey value.
0
 
LVL 11

Accepted Solution

by:
mikeblas earned 200 total points
ID: 1323330
The hot key control doesn't support directly getting the window text. GetWindowText() (or its pal, WM_GETWINDOWTEXT) wosn't work.

However, you can use the GetKeyNameText() API to translate from a scan code to a localized representation of they key name. You can get the virtual code off the control by calling the GetHotKey() member, and you can translate to a virtual key by calling MapVirtualKey().

B ekiM
0
 

Author Comment

by:mikle081198
ID: 1323331
As I see there is no direct way to get this text so I have to accept this answer.
0

Featured Post

How to Use the Help Bell

Need to boost the visibility of your question for solutions? Use the Experts Exchange Help Bell to confirm priority levels and contact subject-matter experts for question attention.  Check out this how-to article for more information.

Question has a verified solution.

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

Introduction: The undo support, implementing a stack. Continuing from the eigth article about sudoku.   We need a mechanism to keep track of the digits entered so as to implement an undo mechanism.  This should be a ‘Last In First Out’ collec…
Have you tried to learn about Unicode, UTF-8, and multibyte text encoding and all the articles are just too "academic" or too technical? This article aims to make the whole topic easy for just about anyone to understand.
This video will show you how to get GIT to work in Eclipse.   It will walk you through how to install the EGit plugin in eclipse and how to checkout an existing repository.
Loops Section Overview
Suggested Courses

807 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