|
-
September 27th, 2006, 02:49 AM
#1
Destroy toolbar problem
Hi !
I'm creating a toolbar i.e. like this:
HTML Code:
bar=new CToolBar();
bar->CreateEx(this, TBSTYLE_FLAT, WS_CHILD | WS_VISIBLE | CBRS_TOP
| CBRS_GRIPPER | CBRS_TOOLTIPS | CBRS_FLYBY | CBRS_SIZE_DYNAMIC, CRect(0, 0, 0, 0),23423);
FloatControlBar(bar,CPoint (400,400));
Next I delete this toolbar i.e. like this:
All look ok, without one point: GDI objects are still allocate in memory (I can find it in monitor). In create are allocate 8 GDI objects, in delete remove only 2. So 6 are still allocate. In my application I create/delete toolbars often, and this generate a problem.
Do you know how safty remove a toolbar from memory with deallocate this gdi objects ?
Thnx in advance
Olek
-
September 27th, 2006, 04:40 AM
#2
Re: Destroy toolbar problem
bar is a C++ object associated with a windows control. Just as you created the control using CreateEx use DestroyWindow before deleting the object.
-
September 27th, 2006, 04:53 AM
#3
Re: Destroy toolbar problem
Unfortuality: This is first what I try. Result is this same: GDI object are not free....
-
September 27th, 2006, 07:06 AM
#4
Re: Destroy toolbar problem
 Originally Posted by olekba
Unfortuality: This is first what I try. Result is this same: GDI object are not free....
Then Would you be so kind to post a little more code to see what and how you created/loaded/destroyed the toolbar and in what class you are using it?
-
September 28th, 2006, 02:08 AM
#5
Re: Destroy toolbar problem
In reality, I extract this, what generate a problem, to another project. And this is in a first post. Here you can find, that this is normal CToolBar.
I try several thinks for destroy this GDI objects, like:
bar->DestroyWindow();
delete bar;
or
//ShowControlBar(bar,FALSE,FALSE);
//bar->EnsureParentFrame()->DestroyWindow();
// bar->SendMessage(WM_NCDESTROY);
//DestroyDockBars();
//CFrameWnd* pFrameWnd = bar->EnsureParentFrame();
//pFrameWnd->DestroyWindow();
But I still see, that nothink changing with a allocate a GDI objects. In my real application create/destroy toolbars is often. In one costumer computer is a problem, that if are to many allocate GDI objects - application crash.
Any ideas ?
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|