0
votes

We have a MFC Dialog with the Microsoft Web Browser activex control for displaying web pages. When a page contains silverlight you cannot type into the silverlight text box. It seems as though mouse and command messages make it to silverlight but not the wm_keydow/wm_keyup

refrance to the microsoft connect issue https://connect.microsoft.com/VisualStudio/feedback/details/536872/silverlight-3-cannot-type-in-textbox-when-running-in-microsoft-web-browser-object

1

1 Answers

0
votes

Workaround 1 - alter the html object for the Silverlight application to be "windowless":

<object data="data:application/x-silverlight-2," type="application/x-silverlight-2" width="100%" height="100%">
                             <param name="source" value="webConnectSilverlightApplication.xap"/>
                             <param name="onError" value="onSilverlightError" />
                             <param name="background" value="white" />
                             <param name="minRuntimeVersion" value="4.0.50826.0" />
                             <param name="autoUpgrade" value="true" />
                             <param name="windowless" value="true"/>
                             <a href="http://go.microsoft.com/fwlink/?LinkID=149156&v=4.0.50826.0" style="text-decoration:none">
                                             <img src="http://go.microsoft.com/fwlink/?LinkId=161376" alt="Get Microsoft Silverlight" style="border-style:none"/>
                             </a>
                </object>

Workaround 2 - override PreTranslateMessage in WebViewer dialog class to override the bug:

BOOL CMFC_WebViewerDlg::PreTranslateMessage(MSG* pMsg)
{
     if (pMsg->message == WM_CHAR)
     {
             DispatchMessage(pMsg);
             return true;
     }

     return CDialog::PreTranslateMessage(pMsg);
}

The probable cause

The problem is the ActiveX control doesn't own the message pump. The message pump is owned by the container application. Therefore, all the keystroke messages are taken by the container application and not dispatched to the modeless dialog box or propertysheet window.

The problem does not occur with a modal dialog box/propertysheet window because the message pump is owned by the dialog box manager, and it takes care of handling all keystroke messages. Blockquote source http://support.microsoft.com/kb/187988