The problem:
We have simple Silverlight application running with two buttons: "Button 1" and "Button 2". When pressing "Button 1" I launch a Message Box using the following code sequence:
HRESULT MainPage::btnPushMe_Click (IXRDependencyObject* pSender, XRMouseButtonEventArgs* pArgs)
{
HRESULT hr = S_OK;
if ((NULL == pSender) || (NULL == pArgs))
{
hr = E_INVALIDARG;
}
HWND hWnd;
IXRVisualHostPtr pVisualHost;
App::GetVisualHost(& pVisualHost);
pVisualHost-> GetContainerHWND(&hWnd);
MessageBox(hWnd, L"Error message", L"Error caption", MB_OK);
return hr;
}
We click the "OK" button of the modal message box, next the Silverlight application doesn't accept any input anymore. It's like the other controls lost their handlers and when the user presses the second button nothing happens.
My assumption
I noticed that if instead of hWnd I just put zero, the message box closes and all works fine after. My logic says that it is something related with the window handler parameter. MSDN says ( http://msdn.microsoft.com/ en-us/library/ee504207.aspx ) : "Use the GetContainerHWND method with caution because the handle you obtain from it is also shared with the Silverlight system." so when the message box is closed something bad happens with that HWND.
My idea it was that the parent HWND is the container HWND. If I am wrong... what owner window HWND I should pass to the MessageBox? ( http://msdn.microsoft.com/ en-us/library/ee503608.aspx )
Somehow my Silverlight app window is not getting anymore Windows messages, and this is why it's not reacting.
Because one picture is like one thousand words, I attached a short video:
Because one picture is like one thousand words, I attached a short video:




