Link to home
Start Free TrialLog in
Avatar of mikle081198
mikle081198

asked on

How to get CHotKeyCtrl text?

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?
Avatar of Answers2000
Answers2000

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)
Avatar of mikle081198

ASKER

Unfortunately neither GetWindowText nor DetDlgItemText does not work. :(
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.
Yes i can do it but i'm searching more direct method, without interpreting hotkey value.
ASKER CERTIFIED SOLUTION
Avatar of mikeblas
mikeblas

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
As I see there is no direct way to get this text so I have to accept this answer.