CString CHotKeyCtrl::GetKeyName(UINT vk, BOOL fExtended)
{
LONG lScan = MapVirtualKey(vk, 0) << 16;
// if it's an extended key, add the extended flag
if (fExtended)
lScan |= 0x01000000L;
CString str;
int nBufferLen = 64;
int nLen;
do
{
nBufferLen *= 2;
LPTSTR psz = str.GetBufferSetLength(nBufferLen);
nLen = ::GetKeyNameText(lScan, psz, nBufferLen + 1);
str.ReleaseBuffer(nLen);
}
while (nLen == nBufferLen);
return str;
}
CString CHotKeyCtrl::GetHotKeyName() const
{
ASSERT(::IsWindow(m_hWnd));
CString strKeyName;
WORD wCode;
WORD wModifiers;
GetHotKey(wCode, wModifiers);
if (wCode != 0 || wModifiers != 0)
{
if (wModifiers & HOTKEYF_CONTROL)
{
strKeyName += GetKeyName(VK_CONTROL, FALSE);
strKeyName += szPlus;
}
if (wModifiers & HOTKEYF_SHIFT)
{
strKeyName += GetKeyName(VK_SHIFT, FALSE);
strKeyName += szPlus;
}
if (wModifiers & HOTKEYF_ALT)
{
strKeyName += GetKeyName(VK_MENU, FALSE);
strKeyName += szPlus;
}
strKeyName += GetKeyName(wCode, wModifiers & HOTKEYF_EXT);
}
return strKeyName;
}
i want to rewrite it using std::string(or char []), but i don't know std::string prototypes for CString::GetBufferSetLength and CString::ReleaseBuffer. Can you help me?
* The Best Reasons to Target Windows 8
Learn some of the best reasons why you should seriously consider bringing your Android mobile development expertise to bear on the Windows 8 platform.