Hi,
We are getting "The operation completed successfully" Win32 exception in a very specific use case. In our application there are some old windows made in Progress OpenEdge that can be opened as children of a main window. The problem occurs when a user opens a context menu in one of them and then tries to open a modal window with a shortcut, they get the following exception:
System.ComponentModel.Win32Exception (0x80004005): The operation completed successfullyat MS.Win32.SafeNativeMethods.ReleaseCapture()
at System.Windows.Window.ShowDialog()
[the next line is already our ShowModalWindow method]
The relevant fragment of System.Windows.Window class on Reference Source has some interesting comments:
if (hWndCapture != IntPtr.Zero) { // // NOTE: hamidm -- 7/14/04 // EnableWindow(false) (called from EnableThreadWindows(false) // sends WM_CANCELMODE to the window, so we don't need // to send it again. However, if we change our impl // of dialog such that we don't disable all windows on the // thread, then we would need this call. Keeping this code here // until we finish the Dialog task # 18498 // UnsafeNativeMethods.SendMessage(hWndCapture, // WindowMessage.WM_CANCELMODE, // IntPtr.Zero, // IntPtr.Zero); // hWndCapture = UnsafeNativeMethods.GetCapture(); // if (hWndCapture != IntPtr.Zero) // { // PS # 862892 // WCP: Investigate whether ReleaseCapture is needed in ShowDialog SafeNativeMethods.ReleaseCapture(); // } }
Simply catching an exception causes the main window to freeze, but leaves the old form operational.
Any ideas what might be causing this behavior and how can we fix it?
Thanks,
Marek