One workarounds option would be to use a stock standard edit control with a message hook function.
This would allow you to trap the keyboard WM_KEYDOWN messages sent to that edit control.
The hook function would look something like this:
LRESULT CALLBACK MessageHook(int code, WPARAM wParam, LPMSG lpMsg)
{
LRESULT lResult = 0;
if ((code >= 0) && (code == MSGF_DIALOGBOX))
{
if (lpMsg->message == WM_KEYDOWN)
{
//-- process the key down message
lResult = 1;
}
}
// do default processing if required
if (lResult == 0)
{
lResult = CallNextHookEx(MessageFilterHook, code, wParam, (LPARAM)lpMsg);
}
return lResult;
}
The hook can then be attached to edit control when the edit control gets focus as follows:
//-- create an instance thunk for our hook callback
FARPROC FilterProc = (FARPROC) MakeProcInstance((HOOKPROC)(MessageHook),
hInstance);
//-- attach the message hook
FilterHook = SetWindowsHookEx(WH_MSGFILTER,
(HOOKPROC)FilterProc,
hInstance, GetCurrentThreadId());
and removed when the edit control when looses focus as follows:
//-- remove a message hook
UnhookWindowsHookEx(MessageFilterHook);
Using this approach every key press will be sent to the hook, provided the edit control has focus.