Intercepting keyboard event
Hi to everyone,
I have a problem in a MFC application...I hope this is the right
newsgroup and that someone would help me :-)
In my MFC application I have a CFormView that contains an ActiveX
control (actually MapPoint Control).
I have created this Control class by means of the class wizard,
selecting "create an MFC class from an ActiveX control": the wizard has
generated a ccontrol1.h file, containing "wrapped" (is right?) method.
My problem is that I want intercept keyboard event, while the control
is running:
I have tried to use the
CControl1::OnKeyDown()
event, but it works only if the control isn't still executing...
I explain: when I load a map into the control, the control itself loose
focus (OnKillFocus event is called) and OnKeyDown() doesn't work.
Is there a way to "intercept" keyboard event, maybe from a higher
level??? I have read that keyboard events go to the component that has
focus....but I'm not able to understand which is it.
I have tried the following code to understand which control gain focus:
void CControl1::OnKillFocus(CWnd* pNewWnd)
{
int ctrlID = pNewWnd->GetDlgCtrlID(); // 59648
}
The method gives me that int value when I have loaded a map in the
control and I click the first time into it. It seems that the MapPoint
ActiveX control "internal engine" takes focus (and gain keyboard
control)...
Would someone give me a hint to solve this problem?
Or giving me the right newsgroup to post this message, if this is the
wrong one???
Many many thanks!!!
HS