I want to change a unicode char inserted using Alt+Unicode code from the keyboard. I used PretranslateMessage for changing the chars inserted directly from the keyboard and it worked. But with the Alt+Unicode code method it does not. Here is the code: Microsoft Word has this functionality when enabling show/hide paragraph marks.
BOOL CEmphasizeEdit::PreTranslateMessage(MSG* msg)
{
if (msg->hwnd == m_hWnd)
{
if (msg->message == WM_CHAR)
{
if (TheApp.Options.m_bShowWSpaceChars)
{
if (msg->wParam == ' ') // This works in both cases Space key pressed or Alt + 3 + 2 in inserted
{
msg->wParam = '·';
}
else if (msg->wParam == (unsigned char)' ') // this does not work
{
msg->wParam = (unsigned char)'°';
}
}
}
}
return CRichEditCtrl::PreTranslateMessage(msg);
}
If I insert from the keyboard Alt + 0 + 1 + 6 + 0 which is ' '(No-Break Space), I want the CRichEditCtrl to display '°' or another char that I specify.
How can I handle this to make it work?
I had to get the cursor position send an append string to the control and then set the selection after the inserted character. When this happens I have to skip CRichEditCtrl::PreTranslateMessage(msg);