CMainFrame not skinned |
Post Reply |
Author | |
feffe
Groupie Joined: 04 September 2009 Status: Offline Points: 56 |
Post Options
Thanks(0)
Posted: 15 January 2010 at 4:37am |
Hi,
I'd like that every window of my application to be skinned, but not my CMainFrame.
I call XTPSkinManager()->AutoApplyNewWindows(TRUE) and XTPSkinManager()->LoadSkin(...)
in CMainFrame constructor.
Then, in CMainFrame::OnCreate, I call XTPSkinManager()->Remove(m_hWnd) but it doesn't seem to work.
Where am I wrong?
Thanks a lot
|
|
feffe
Groupie Joined: 04 September 2009 Status: Offline Points: 56 |
Post Options
Thanks(0)
|
...Any idea?
My app is too slow if I have the mainframe skinned...
|
|
znakeeye
Senior Member Joined: 26 July 2006 Status: Offline Points: 1672 |
Post Options
Thanks(0)
|
My idea: that's impossible
Are you sure CMainFrame is the window being skinned?
Perhaps you have some MDI children that occupy the view and makes it look like the main frame is skinned?
Try stepping into CXTPSkinManager::Remove and see what goes wrong...
|
|
PokerMemento - http://www.pokermemento.com/
|
|
feffe
Groupie Joined: 04 September 2009 Status: Offline Points: 56 |
Post Options
Thanks(0)
|
I've tried to study the problem...
And I've seen that the call AutoApplyNewWindow(TRUE) really slows down my program.
So...
Is there a method for having skinned dialo without calling it?
My problem is especially when I need calling "afxmessagebox..."...
Any suggestion?
EDIT: I think I've the same problem already explained in the thread
|
|
znakeeye
Senior Member Joined: 26 July 2006 Status: Offline Points: 1672 |
Post Options
Thanks(0)
|
AfxMessageBox is tricky... HHOOK CYourApp::s_hMsgBoxHook = NULL;
LRESULT CALLBACK CYourApp::CBTProc(int nCode, WPARAM wParam, LPARAM lParam)
{ if (nCode < 0) return CallNextHookEx(s_hMsgBoxHook, nCode, wParam, lParam); if (nCode == HCBT_CREATEWND)
{ UnhookWindowsHookEx(s_hMsgBoxHook); s_hMsgBoxHook = NULL; XTPSkinManager()->ApplyWindow((HWND)wParam);
return 0;
} // Call the next hook, if there is one.
return CallNextHookEx(s_hMsgBoxHook, nCode, wParam, lParam); } int CYourApp::DoMessageBox(LPCTSTR lpszPrompt, UINT nType, UINT nIDPrompt)
{ // Install a window hook, so we can intercept the message-box creation, and customize it. s_hMsgBoxHook = SetWindowsHookEx(WH_CBT, CBTProc, NULL, GetCurrentThreadId()); // Display a standard message box. int retVal = CWinApp::DoMessageBox(lpszPrompt, nType, nIDPrompt); // Remove the window hook!
if (s_hMsgBoxHook) UnhookWindowsHookEx(s_hMsgBoxHook); return retVal; } Anyway, are you absolutely sure that AutoApplyNewWindows is the culprit? If that is the case, I would really like to avoid it myself. Haven't seen problems with it so far though.
|
|
PokerMemento - http://www.pokermemento.com/
|
|
feffe
Groupie Joined: 04 September 2009 Status: Offline Points: 56 |
Post Options
Thanks(0)
|
Thank you very much znakeeye...
Contextmenus are the part of my application that really slows down...
So, perhaps, can I leave the "AutoAplly" call and disactivate any aspect of the skin when I show contextmenus?
Thank you
|
|
znakeeye
Senior Member Joined: 26 July 2006 Status: Offline Points: 1672 |
Post Options
Thanks(0)
|
I don't see how a context menu could slow things down. Please post code that you run when displaying a context menu!
Is it possible that one of your update-handlers goes nuts? E.g. enabling -> disabling -> enabling -> disabling...?
|
|
PokerMemento - http://www.pokermemento.com/
|
|
feffe
Groupie Joined: 04 September 2009 Status: Offline Points: 56 |
Post Options
Thanks(0)
|
Afraid the problem is that I'm using also MFC Feature Pack classes.
The method you've explained me in the previous post (with CBTProc)
could be used also for EVERY kind of window, not only message boxes?
In this way, I try to avoid the call to AutoApply but I obtain the same effect.
EDIT: your method doesn't skin buttons of messageboxes.
Maybe missed to set an option?
Thanks a lot!!
|
|
znakeeye
Senior Member Joined: 26 July 2006 Status: Offline Points: 1672 |
Post Options
Thanks(0)
|
The skin-engine is activated on a "per-window" basis. You need to add all child-windows too. I guess you can enumerate the children of the messagebox window, but this means you've essentially implemented the same hooking functionality that Codejock already has (although this would only be for message boxes).
For your own windows, a hook is not necessary. All you need is to handle CYourWnd::OnCreate(...) and add m_hWnd to the skin-manager.
|
|
PokerMemento - http://www.pokermemento.com/
|
|
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 |