I have an MDI app, built in VS2008. On some childframes, I have inserted some CDockablePane. But I have a probem: <b>They don't know to save their state and position</b>. The CDockablePane's ones that is part of CMainFrame know how to save their state and position without any written code, through CDockingManager class ...
But this is not the case, when CDockablePane is part of CChildFrame ...
Detected memory leaks!
Dumping objects ->
f:\dd\vctools\vc7libs\ship\atlmfc\src\mfc\afxpanecontainer.cpp(2382) : {27179} client block at 0x0267BEC8, subtype c0, 156 bytes long.
a CPaneContainer object at $0267BEC8, 156 bytes long
Object dump complete.
The program '[8876] Model.exe: Native' has exited with code 0 (0x0).
and
Code:
DestroyWindow in CWnd::~CWnd; OnDestroy or PostNcDestroy in derived class will not be called.
is there any solution to save/restore the pane's from child frame ?
I attach here a sample code that illustrate the problem ...
Last edited by mesajflaviu; May 30th, 2017 at 01:39 AM.
It passed a long time since I am not engaged in MFC-related development. However, as from what, I remember, during that timescale, you need to release any resource you have created in your application. For example, if it would the drawing facility like device context, there's a necessity to release it after acquiring its handle. The same technique is applicable here.
I think I have found the problem: in the creation of m_wndFilter, I didn't put an distinct ID, but 0. Soon as I identified with ID, everything work ok, with the solution:
Warning: calling DestroyWindow in CWnd::~CWnd; OnDestroy or PostNcDestroy in derived class will not be called.
or
Code:
Warning: calling DestroyWindow in CDialog::~CDialog -- OnDestroy or PostNcDestroy in derived class will not be called.
means that an object of CWnd-derived or CDialog-derived class, is being destroyed without previously destroy the window. As a consequence if you handled WM_DESTROY message or overrode PostNcDestroy, they will never called.
One solution to get rid this issue by calling DestroyWindow in the derived class destructor (of course if the window is not yet destroyed).
The funny thing here is that I get rid of these ML and warnings, solving the problem: when I create the pane, I give him a real ID, not 0 ... I am thinking that inside of MFC code is searching for the pane ID, and as long as it didn't found this ID, the resources were not freed ... I guess.
Last edited by mesajflaviu; June 2nd, 2017 at 07:09 AM.
* The Best Reasons to Target Windows 8
Learn some of the best reasons why you should seriously consider bringing your Android mobile development expertise to bear on the Windows 8 platform.