Converting HotKey Virtual Key codes to Strings and Back Again


Thanks so much to everyone who's helped me on this forum, I hope I'm not too annoying. I'm not exactly sure where to post this, because it's not directly related to the FSX or SimConnect API, but I figure it's probably something Flight Sim developers know how to do - if there's a better place for it, let me know. Issue is this:

As part of my LF/MF Range project, I'm trying to create a Key input configuration tool so the user can set keys to control the various radio switches. I'm using MFC CHotKeyCtrl objects to get the desired settings from the user. Then I have to convert the code returned from CHotKeyCtrl::GetHotKey() to a string, which I can write to a configuration file which can be viewed and edited by the user. This same string will also be passed to SimConnect to set up the key input notifications for my application. Then I need to convert the string back to a virtual key code with modifiers, so that I can pass it in this format as arguments to CHotKeyCtrl::SetHotKey(), so the stored settings are displayed when the configuration utility is opened.

Unfortunately, I've spent a couple days now mired in a maze of virtual key codes, unable to reliably convert back and forth between strings and virtual key codes, especially when it comes to extended keys and numpad keys. The hotkey control seems to ignore the state of scroll lock or num lock, so all the input will appear in the control as "Num 7", "Num 9", etc, but then GetHotKey() will return a VK_HOME, VK_PRIOR, etc. In addition, when loading, if I pass the control VK_NUM7, it will display as "Home". I've written a what seems like heck of a lot of code on this bit, and it's still not quite working... I can't help feeling I must be reinventing the wheel.

So my question is, is there some library, class, functions, or tutorial which already exists, which handles reading Hotkey controls, converting them to a config-file-suitable string format, converting them back? It seems like I'm writing a lot of code which probably exists in some tutorial somewhere, I just can't seem to find it. If you've written a key input tool before, how did you do it? What tools did you use? Can you give me any pointers? Is it just hard, and I need to figure it out? Am I missing something obvious? etc. Any tips would be very, very much appreciated. I apologize if I seem a little desperate.