Solved

How to get CHotKeyCtrl text?

Posted on 1998-10-15
6
245 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
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: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 100 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

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Expand macro to include alternate header placement and naming 5 75
repeatSeparator  java  challenge 13 58
Add content to output file 4 67
no14 challenge 14 70
In this article, I'll describe -- and show pictures of -- some of the significant additions that have been made available to programmers in the MFC Feature Pack for Visual C++ 2008.  These same feature are in the MFC libraries that come with Visual …
Introduction: Dynamic window placements and drawing on a form, simple usage of windows registry as a storage place for information. Continuing from the first article about sudoku.  There we have designed the application and put a lot of user int…
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.
I've attached the XLSM Excel spreadsheet I used in the video and also text files containing the macros used below. https://filedb.experts-exchange.com/incoming/2017/03_w12/1151775/Permutations.txt https://filedb.experts-exchange.com/incoming/201…

808 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