?
Solved

How to get CHotKeyCtrl text?

Posted on 1998-10-15
6
Medium Priority
?
251 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
[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
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
Learn how to optimize MySQL for your business need

With the increasing importance of apps & networks in both business & personal interconnections, perfor. has become one of the key metrics of successful communication. This ebook is a hands-on business-case-driven guide to understanding MySQL query parameter tuning & database perf

 

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

Percona Live Europe 2017 | Sep 25 - 27, 2017

The Percona Live Open Source Database Conference Europe 2017 is the premier event for the diverse and active European open source database community, as well as businesses that develop and use open source database software.

Question has a verified solution.

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

Here is how to use MFC's automatic Radio Button handling in your dialog boxes and forms.  Beginner programmers usually start with a OnClick handler for each radio button and that's just not the right way to go.  MFC has a very cool system for handli…
Introduction: Hints for the grid button.  Nested classes, templated collections.  Squash that darned bug! Continuing from the sixth article about sudoku.   Open the project in visual studio. First we will finish with the SUD_SETVALUE messa…
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.
Visualize your data even better in Access queries. Given a date and a value, this lesson shows how to compare that value with the previous value, calculate the difference, and display a circle if the value is the same, an up triangle if it increased…
Suggested Courses

777 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