Click here to Skip to main content
15,895,833 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
Hello,

My application got hung giving a popup message that application busy wait or close.
I created a dump file to analyse before closing the application. Below is the call stack. I could not get the root cause.
The function of my application which call stack is pointing (spos!CWnd::BringWindowToTop) executes fine normally.

Do not know why it failed.

Below is the stack:

000e3e2c 0042aac4 0000004e 00b6000c 000fb380 ntdll!KiFastSystemCallRet
000e3e3c 0088b56f 0b911978 00000000 00405637 spos!CWnd::BringWindowToTop+0x14 [C:\Program Files\Microsoft Visual Studio\VC98\MFC\INCLUDE\afxwin2.inl @ 94]
000fb380 5f401e6e 00001f40 0b911978 0b911978 spos!CSposView::OnTimer+0x92dd [C:\DEVTCS\POS\Legacy\SPOS_MIDCOUNTIES-272AutoRefund\sposView.cpp @ 4452]
000fb3fc 5f401aff 00000113 00001f40 00a2d8d8 mfc42!Ordinal5163+0x34d
000fb41c 5f401a88 00000113 00001f40 00000000 mfc42!Ordinal6374+0x22
000fb47c 5f401a10 00000000 000b0100 00000113 mfc42!Ordinal1109+0x74
000fb498 5f4019cf 000b0100 00000113 00001f40 mfc42!Ordinal1578+0x2a
000fb4c4 7714c4e7 000b0100 00000113 00001f40 mfc42!Ordinal1579+0x39
000fb4f0 7714c5e7 5f401996 000b0100 00000113 user32!gapfnScSendMessage+0x1cf
000fb568 7714cc19 00000000 5f401996 000b0100 user32!gapfnScSendMessage+0x2cf
000fb5c8 77142e41 5f401996 00000001 00000fa0 user32!gapfnScSendMessage+0x901
000fb5d8 0ca2b67f 000fb5f8 0000000a 0db10340 user32!DispatchMessageA+0xf
00000fa0 00000000 00000000 00000000 00000000 WN_DrawRS232!DllUnregisterServer+0x9daf


basically below portion is what windbg is referring to:

if(nIDEvent == FOCUS_TIMER && !WINCOR_IF())
{
    try
    {
        if(theApp.pActiveDialog != NULL && IsWindow(theApp.pActiveDialog->m_hWnd))
        {

            CWnd * CurrentWindow = GetActiveWindow();

            if(CurrentWindow->m_hWnd != theApp.pActiveDialog->m_hWnd )
            {
                theApp.pActiveDialog->BringWindowToTop();
                theApp.pActiveDialog->SetFocus();
                theApp.pActiveDialog->RedrawWindow();
                CString OutMessage;
                CString cstrCurrent;
                CurrentWindow->GetWindowText(cstrCurrent);
                CString cstrActive;
                theApp.pActiveDialog->GetWindowText(cstrActive);
                OutMessage.Format("** Active Window has not got focus. Current Window = '%s' attempting to set '%s' as the active window",cstrCurrent,cstrActive);
                LogErrorMessage(__LINE__,__FILE__,OutMessage);
            }
        }

    }
    catch(...)
    {
        //Not a valid pointer
        theApp.pActiveDialog = NULL;
    }


Though it happened only once. and it worked fine on next execution. Could it be anything related to windows issue?
Posted
Updated 31-Jul-15 3:40am
v3
Comments
Leo Chapiro 31-Jul-15 8:25am    
Show your code, dude!
Richard MacCutchan 31-Jul-15 8:30am    
Possibly something to do with your OnTimer function. However, without seeing any of your code it is anyone's guess.
Sergey Alexandrovich Kryukov 31-Jul-15 10:17am    
Not enough information. Are you using a timer and do so some UI manipulations in the handler? Is so, this is a bad, dangerous idea. You need to explain what you want to achieve in detail. Would it be possible to create an extremely small project showing only the same problem and nothing else, so you could provide 100% of its code?
—SA
arjits 31-Jul-15 12:20pm    
Hello Sergey and Richard and third one (sorry don't know your name)

Thanks you for your time. This is a very intermittent issue and I can not recreate it.
My exe is failing (crashing) very intermittently and memory dumps are not providing much details on where the issue is.

When I run it in debug mode it runs fine with no crash or hang.

I can understand the information is very less to give any suggestions, however if you guys can suggest me any line of action or couple of pointers where to look for crash and hang of exe that would be very helpful.

Regards,
Arjit
barneyman 2-Aug-15 20:29pm    
does pActiveDialog get changed by another thread, or message handler?

i'd put a mutex round it if that's the case

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900