Key strokes in wpf window hosted in MFC ActiveX running in Internet Explorer

Posted by user310046 on Stack Overflow See other posts from Stack Overflow or by user310046
Published on 2010-04-06T13:49:26Z Indexed on 2010/04/06 13:53 UTC
Read the original article Hit count: 315

Filed under:
|
|
|

We have an MFC ActiveX control created in Visual Studio 2008 with CLR support which creates a WPF grid and shows a WPF window within that grid.

This ActiveX is hosted within Internet Explorer and it shows up and works nicely except that the tab key, backspace, function keys etc. does not work since they are handeled by IE instead of the WPF window. Regular characters works nicely. This is a known feature and previously when we used to have MFC based dialogs within this ActiveX we used this: http://support.microsoft.com/kb/187988. By just using this code directly the

AfxGetApp()->PreTranslateMessage((LPMSG)lParam) 

statement will return FALSE, so I'm not able to get the key stroke to be handled by the WPF window. I beleive I need to ask the WPF application this instead of the CWinApp, but I'm not sure how and if this can be done. Does anyone have enough understanding of what's going on here to get this to work?

Using XBAP instead of ActiveX is not an option as this is run in an intranet application which needs more access than the sandbox can give us.

I hope this is enough information.

With best regards

Svein Dybvik

© Stack Overflow or respective owner

Related posts about wpf

Related posts about activex