![]() |
Use SetTheme in DLL |
Post Reply
|
| Author | |
Robby
Newbie
Joined: 17 August 2005 Status: Offline Points: 9 |
Post Options
Thanks(0)
Quote Reply
Topic: Use SetTheme in DLLPosted: 17 August 2005 at 9:32am |
|
my program will show a regular dialog, it's a normal cdialog,and it has a cbotton control, press this button will show another cdialog,this dialog is defined in my dll. in this dialog,I add a cxtbotton to it, and then m_button.SetTheme(new CXTButtonThemeOfficeXP(TRUE)). it's ok when i show this dialog,the theme looks nice,but when i quit the program , an error occured,i'm sorry i can't remember the detail infomation about this error. this error occured both in dynamic link with mfc dll and static link with mfc. i test in a normal dialog program(normal means i build an .exe program not .dll),it works well. i just wanta know is there anything i should do when i use settheme function in my dll? any advice would be appreciated! P.S: i use XT pro and VC6 Edited by Robby |
|
![]() |
|
Robby
Newbie
Joined: 17 August 2005 Status: Offline Points: 9 |
Post Options
Thanks(0)
Quote Reply
Posted: 17 August 2005 at 9:06pm |
|
the error says debug assertion failed in xtthememanager.cpp i debug the code found that the error happened in CXTThemeManager::~CXTThemeManager() ASSERT(m_factoryList.m_pHead == 0); //here |
|
![]() |
|
Oleg
Senior Member
Joined: 21 May 2003 Location: United States Status: Offline Points: 11234 |
Post Options
Thanks(0)
Quote Reply
Posted: 18 August 2005 at 4:15am |
|
Thank you for details, we will try to reproduce it to find solution for you. Any hints what is your dll is? (MFC extension, MFC dll, simple Win32 dll) |
|
|
Oleg, Support Team
CODEJOCK SOFTWARE SOLUTIONS |
|
![]() |
|
Oleg
Senior Member
Joined: 21 May 2003 Location: United States Status: Offline Points: 11234 |
Post Options
Thanks(0)
Quote Reply
Posted: 18 August 2005 at 6:15am |
|
Check sample. DOn't see any assert errors :( |
|
|
Oleg, Support Team
CODEJOCK SOFTWARE SOLUTIONS |
|
![]() |
|
Robby
Newbie
Joined: 17 August 2005 Status: Offline Points: 9 |
Post Options
Thanks(0)
Quote Reply
Posted: 18 August 2005 at 9:23am |
|
thank you for your reply. it's a mfc dll. just some dialog things,i have checked sample for several times. may be i should check again |
|
![]() |
|
franji1
Groupie
Joined: 28 June 2005 Status: Offline Points: 70 |
Post Options
Thanks(0)
Quote Reply
Posted: 22 August 2005 at 3:54pm |
|
I had a similar problem with version 8.6, which has to do NOT with when the DLL that "new"ed the specific custom theme, but with WHERE the constructor/destructor code of the custom theme is located. In my case, the custom theme code is IN A DLL - this is BAD, as I will describe below. The "global theme manager" is a static? global? object that gets "free"ed when the .EXE shuts down (I can't remember the specific call, but basically the C++ startup/shutdown code calls the destructors of all "global/static" objects at shutdown). Regardless, the .DLL that has the code for the custom theme is now UNLOADED when the global theme manager is destroyed. What's the big deal? The deal is that the destructor of a theme is VIRTUAL, hence when the code in the global theme manger that deletes this custom theme is CALLED, the DLL that this virtual function pointed to is now GONE! The "correct" fix is to implement ALL custom themes in the main .EXE, but I wanted mine in a DLL for reasons that are only valid to me, cuz sometimes I like it that way My fix for shutting down with custom themes implemented in a DLL, though crude, works. "Standard" themes do not have this problem because their code is still "in memory" (even though we use the XTP as a DLL?!?). Anyway, all I do is call CXTPPaintManager::SetTheme(xtpThemeOfficeXP) first thing in the OnDestroy of my main CFrameWnd dervied window. This causes the current theme to be swapped out with one of the "predefined" themes at the last possible moment. The previous theme's destructor is called while its code is still loaded, hence no crash at shutdown! |
|
![]() |
|
Robby
Newbie
Joined: 17 August 2005 Status: Offline Points: 9 |
Post Options
Thanks(0)
Quote Reply
Posted: 25 August 2005 at 7:41am |
|
that make sense! but my problem haven't appear for several days ,i do nothing . it's amazing.... anyway thank you for your explicit reply |
|
![]() |
|
Post Reply
|
|
|
Tweet
|
| Forum Jump | Forum Permissions ![]() You cannot post new topics in this forum You cannot reply to topics in this forum You cannot delete your posts in this forum You cannot edit your posts in this forum You cannot create polls in this forum You cannot vote in polls in this forum |