Codejock Forums Homepage
Forum Home Forum Home > Codejock Products > Visual C++ MFC > Skin Framework
  New Posts New Posts RSS Feed - HTML-Help window is not closing
  FAQ FAQ  Forum Search   Events   Register Register  Login Login

HTML-Help window is not closing

 Post Reply Post Reply
Author
Message Reverse Sort Order
Dieter View Drop Down
Groupie
Groupie


Joined: 22 July 2006
Status: Offline
Points: 15
Post Options Post Options   Thanks (0) Thanks(0)   Quote Dieter Quote  Post ReplyReply Direct Link To This Post Topic: HTML-Help window is not closing
    Posted: 13 November 2009 at 2:01pm
Thank you very much both of you!

My problem is solved.

Originally posted by Smucker Smucker wrote:



Another unrelated note: you can build applications compatible with Windows 98 & NT4 with any later version of Visual C++, you just have to be careful not to use any unsupported APIs or dlls, or provide code to dynamically bind for libraries/apis similarly to what you're doing in CheckHtmlHelp(). I believe Codejock has some helper routines to make this easier too.



You're right, I should switch to an actual version of Visual C++.
Visual Studio 2008 and 2010 have so many new features, I'm using 2008 already for new applications.
And it becomes more and more difficult to get third party development tools which still work with Visual C++ 6.0.

Dieter

Product: Xtreme ToolkitPro version 15.2.1
Platform: Windows XP (32bit) - SP 3
Language: Visual C++ 6.0, Visual Studio 2010
Back to Top
Oleg View Drop Down
Admin Group
Admin Group


Joined: 21 May 2003
Location: United States
Status: Offline
Points: 11234
Post Options Post Options   Thanks (0) Thanks(0)   Quote Oleg Quote  Post ReplyReply Direct Link To This Post Posted: 13 November 2009 at 3:31am
Thanks, Yes it can be reason. We are changing RemoveAll method.
 
Dieter , Please temporary comment CXTPLockGuard lock(m_csObjects); inside CXTPSkinManager::RemoveAll and rebuild library.
Oleg, Support Team
CODEJOCK SOFTWARE SOLUTIONS
Back to Top
Smucker View Drop Down
Senior Member
Senior Member
Avatar

Joined: 02 February 2008
Status: Offline
Points: 156
Post Options Post Options   Thanks (0) Thanks(0)   Quote Smucker Quote  Post ReplyReply Direct Link To This Post Posted: 12 November 2009 at 1:35pm
Here is some possible help:

I duplicated the problem here. The process is not exiting because of a deadlock. The main thread is in CXTPSkinObject::UnattachHook() waiting for a ::SendMessage() to the tab control in the Help window to complete. However, the thread trying to handle that message (in  CXTPSkinManager::HookWndProc() ) is waiting on a critical section owned by the main thread.

Here are the relevant stacks from the threads:

Main thread:
...
USER32.dll!_SendMessageW@16+0x7f
thumbs8.exe!CXTPSkinObject::UnattachHook+0x57
thumbs8.exe!CXTPSkinManager::RemoveAll+0x98
thumbs8.exe!CXTPSkinManager::~CXTPSkinManager+0xfb
thumbs8.exe!CXTPSkinManager::`scalar deleting destructor'+0x2b
thumbs8.exe!CXTPSkinManager::CDestructor::~CDestructor+0x62
thumbs8.exe!`dynamic atexit destructor for '__xtpSkinManagerDestructor''+0x28
thumbs8.exe!doexit+0x10a
thumbs8.exe!exit+0x12
...

Help thread:
...
ntdll.dll!_ZwWaitForSingleObject@12+0x15
ntdll.dll!_RtlpWaitOnCriticalSection@8+0x155
ntdll.dll!_RtlEnterCriticalSection@4+0x152
thumbs8.exe!CXTPLockGuard::LockThread+0x31
thumbs8.exe!CXTPLockGuard::CXTPLockGuard+0x33
thumbs8.exe!CXTPSkinManager::Lookup+0x56
thumbs8.exe!CXTPSkinManager::HookWndProc+0x2e
USER32.dll!_InternalCallWinProc@20+0x23
USER32.dll!_UserCallWinProcCheckWow@32+0x109
USER32.dll!_DispatchClientMessage@24+0xe0
USER32.dll!___fnDWORD@4+0x2b
ntdll.dll!_KiUserCallbackDispatcher@12+0x2e
USER32.dll!__PeekMessage@24+0x88
USER32.dll!_PeekMessageA@20+0x142
hhctrl.ocx!?AWMessagePump@@YGXPAUHWND__@@@Z+0x5c
hhctrl.ocx!_HhWindowThread@4+0x10e
thumbs8.exe!CXTPSkinManagerApiHook::ThreadProcHook+0x62
...

One simple solution, which also helps release builds of complex applications to exit quickly, is to simply TerminateProcess() once external resources (databases, writable files, sockets, etc.) are closed, rather than go through the many and various laborious cleanup routines for memory, handles, etc. However, I wouldn't recommend this on Windows 9x/ME because GDI handles, color profiles, and shared memory will leak.

Another unrelated note: you can build applications compatible with Windows 98 & NT4 with any later version of Visual C++, you just have to be careful not to use any unsupported APIs or dlls, or provide code to dynamically bind for libraries/apis similarly to what you're doing in CheckHtmlHelp(). I believe Codejock has some helper routines to make this easier too.


Product: Xtreme Toolkit Pro version 13.2 (Unicode, static build)

Platform: Windows 200x/XP/Vista/Win7 (32/64 bit)

Language: Visual C++ 9.0 (Studio 2008)

Back to Top
Dieter View Drop Down
Groupie
Groupie


Joined: 22 July 2006
Status: Offline
Points: 15
Post Options Post Options   Thanks (0) Thanks(0)   Quote Dieter Quote  Post ReplyReply Direct Link To This Post Posted: 12 November 2009 at 10:05am
Hi Oleg,

First, I'm checking with the following code if HTML help is available:

CheckHtmlHelp()
{
    BOOL bSucceeded = FALSE;
    HINSTANCE hHTMLHelpInstance;

    typedef HWND (WINAPI *FPHH) (HWND, LPCSTR, UINT, DWORD);
    FPHH htmlHelp;

    // Load hhctrl.ocx.
    hHTMLHelpInstance = LoadLibrary (TEXT("hhctrl.ocx"));

    if (hHTMLHelpInstance != NULL)
    {
#ifdef UNICODE
        const TCHAR *pszHtmlHelp = "HtmlHelpW";
#else
        const TCHAR *pszHtmlHelp = "HtmlHelpA";
#endif
        (FARPROC&) htmlHelp = GetProcAddress(hHTMLHelpInstance, pszHtmlHelp);

        if (htmlHelp == NULL)
        {
            TRACE ("WARNING : hhctrl.ocx loaded but GetProcAddress failed");

            bSucceeded = FALSE;
        }
        else
        {
            bSucceeded = TRUE;
        }
        FreeLibrary (hHTMLHelpInstance);
    }
    return bSucceeded;
}


Finally, I'm opening the HTML file with the following code:
HtmlHelp(::GetDesktopWindow(), AfxGetApp()->m_pszHelpFilePath, HH_HELP_CONTEXT, nCmd == HELP_CONTEXT ? dwData : 0)

I've checked today with a smaller project where I'm also using the skin framework: In this smaller project I've no problem with HTMLHelp.


Dieter

Product: Xtreme ToolkitPro version 15.2.1
Platform: Windows XP (32bit) - SP 3
Language: Visual C++ 6.0, Visual Studio 2010
Back to Top
Oleg View Drop Down
Admin Group
Admin Group


Joined: 21 May 2003
Location: United States
Status: Offline
Points: 11234
Post Options Post Options   Thanks (0) Thanks(0)   Quote Oleg Quote  Post ReplyReply Direct Link To This Post Posted: 12 November 2009 at 7:25am
Hi,
 
Show code you use to show HTML help from VC6 project.
Oleg, Support Team
CODEJOCK SOFTWARE SOLUTIONS
Back to Top
Dieter View Drop Down
Groupie
Groupie


Joined: 22 July 2006
Status: Offline
Points: 15
Post Options Post Options   Thanks (0) Thanks(0)   Quote Dieter Quote  Post ReplyReply Direct Link To This Post Posted: 11 November 2009 at 1:49pm
I've several applications which use the Skin Framework and HTML-Help (CHM-File).
The applications are built with Visual C++ 6 because they have to run on older Windows operating systems (Windows 98, NT4).

With Codejock 13.0 the CHM help window has been opened and closed with skinning without any problems:
Also the help window closed automatically when my applications have been closed.

Now with the Codejock versions 13.1.0 and 13.2.1 the CHM help window is opened correctly,
but when the application is closed, the help window isn't automatically closed:
The help window remains about 10 seconds skinned and after 10 seconds the skinning of the help window disappears but the help window remains open.


Can you tell me what has been changed between Codejock 13.0 and 13.1/13.2.1 and could be now the cause for the CHM-help window problem?

Dieter

Product: Xtreme ToolkitPro version 15.2.1
Platform: Windows XP (32bit) - SP 3
Language: Visual C++ 6.0, Visual Studio 2010
Back to Top
 Post Reply Post Reply
  Share Topic   

Forum Jump Forum Permissions View Drop Down

Forum Software by Web Wiz Forums® version 12.04
Copyright ©2001-2021 Web Wiz Ltd.

This page was generated in 0.109 seconds.