Hi,
I encountered strange behaviour of my application. I would like to close frame window in MDI application, so I send WM_SYSCOMMAND (SC_CLOSE) to that window. After that, I receive OnSysCommand. Then I call CMDIChildWnd::OnSysCommand to proceed processing.
The problem is, that sometimes base implementation of OnSysCommand calls OnClose and my frame is destroyed and sometimes not. I made an investigation and it seems that differences appear in _NtUserMessageCall (actually this method calls some kernel-mode function which fails). When WS_SYSCOMMAND succeeds than _NtUserMessageCall calls DispatchHook and whole bunch of user32.dll methods and my message reaches target window. If it fails, frame window is not closed and OnClose is not called.
I run out of ideas what can cause such strange behaviour. I checked application with Application Verifier and everything seems to be fine. One more thing, the problem appears only if my application is launched through COM.
I'm fighting with this problem for two days and I need some fresh clues where to continue digging.