|
So far I have found this behaviour only relates to CreateRgn set of functions. As you probably know already my current project is very region intensive. Nowhere in my code do I directly SelectObject() a region into a DC, I always use the SetClip() set of functions and even those calls are made using global regions which will not be deleted.
It's safe to say that DeleteObject() is working and that there is no leakage, but can you imaging the feedback I would get when users take a look at the task manager?
|
|
|
|
|
Not seeing your code I can not tell for sure, but as you know any GDI object can cause this problem. Just because you use HRGNs extensively does not mean that is where the problem lies. I once had it with an icon in the title bar of a child window. One icon and it did not take long to have a couple hundred GDI objects just floating around. Look very carefully at all your GDI objects.
I do not know of a free tool that will point out which objects are leaking, so good luck in finding it.
You may be right I may be crazy -- Billy Joel --
Within you lies the power for good, use it!!!
|
|
|
|
|
PJ Arends wrote: I do not know of a free tool that will point out which objects are leaking, so good luck in finding it.
This is the thing, there are no leaks. That code sample was placed on the very first line of my WinMain(), so no other objects are created and no DC's are present. The object does get deleted, but the count does not decrease to reflect the change. I have confirmed this by checking with "Task Manager" and the GetGuiResources() api call.
To detect memory leaks I am using Deleaker[^] which reports no errors.
|
|
|
|
|
For what it's worth I tried this (in a console app):
for ( int i=0; i<100; i++ )
{
HRGN hRgn = ::CreateRectRgn(0, 0, 10, 10);
::DeleteObject(hRgn);
Sleep(1000);
}
and watched the task manager. GDI Objects climbed to 9 (went from 4 at startup to 11 13) and stayed
there until the end.
I can't find any documentation on Windows caching these internally either
Good luck!
Mark
*EDIT* This test was on XP Pro Version 2002 SP2
|
|
|
|
|
Hello all,
I would like to solve a mystery:
If you have more that one keyboard layout they are displayed on the taskbar.
Every thread can change its language.
Now if you have a dialog which uses msrdp.ocx the language monitor is hidden.
How can you hide this monitor ??? or better how can you display it.
Can you get the current language for a prticular window that is not your process (this is what the language bar does)?
thanks
Zippo
|
|
|
|
|
Ok, could someone please explain this to me. As it seems a manifest file is stopping my application from loading. And I'd like to make sure my machine isn't going crazy or that I'm not playing the retard today. Anyway, my app in question uses the following manifest...
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<assembly xmlns="urn:schemas-microsoft-com:asm.v1" manifestVersion="1.0">
<assemblyIdentity processorArchitecture="x86" version="5.1.0.0" type="win32" name="Colorz.exe"></assemblyIdentity>
<description>Colorz</description>
<dependency>
<dependentAssembly><assemblyIdentity type="win32" name="Microsoft.Windows.Common-Controls" version="6.0.0.0" publicKeyToken="6595b64144ccf1df" language="*" processorArchitecture="x86"></assemblyIdentity></dependentAssembly>
</dependency>
<dependency>
<dependentAssembly><assemblyIdentity type="win32" name="Microsoft.VC80.CRT" version="8.0.50608.0" processorArchitecture="x86" publicKeyToken="1fc8b3b9a1e18e3b"></assemblyIdentity></dependentAssembly>
</dependency>
</assembly>
The bolded line is cause the problems. Which I added to include xp themes for a native app. Simply removing it allows the app to run, but I don't have themes. I should mention that it's worked fine in the past so I'm hoping it doesn't mean something is messed up on my machine.
The app in question is Colorz[^] if you'd like to try to reproduce this. Could someone please shed some light on this.
TIA
|
|
|
|
|
Let me guess. You took the old VC6 workspace file, opened it in VC8 and let the conversion wizard do it's thing. And now you are trying to retofit XP themes into the app. My experience is that that does not work. It causes more headaches than it is worth. If you really want to upgrade the app then use the VC8 new app creation wizard to create a new app and then copy the source files over, and open the RC files as text and do a copy/paste with the resources. The conversion wizard just leaves way to much crap behind.
|
|
|
|
|
PJ Arends wrote: Let me guess. You took the old VC6 workspace file, opened it in VC8 and let the conversion wizard do it's thing.
Good guess.
PJ Arends wrote: The conversion wizard just leaves way to much crap behind.
I may very well do this, now and in the future. One thing that gets me is it did work before, using the same projects. It just stopped working and I'm hoping it wasn't due to my system getting messed up. It doesn't seem messed up so I don't know.
|
|
|
|
|
It probably never did work, just that with your old monitor you could not tell the difference.
|
|
|
|
|
PJ Arends wrote: It probably never did work, just that with your old monitor you could not tell the difference
|
|
|
|
|
I went ahead and created a new project, adding the files manually, etc. and it still doesn't work. Out of curiosity, does the themed Colorz run ok on your system?
Thanks for the help btw.
|
|
|
|
|
I downloaded the exe from your article and ran it. Everything does look ok. I took a screen shot so you can compare it to what you are seeing on your machine. http://www3.telus.net/pja/colorz.PNG[^]
You may be right I may be crazy -- Billy Joel --
Within you lies the power for good, use it!!!
|
|
|
|
|
Now I'm convinced something is wrong with my machine. Thanks again.
|
|
|
|
|
Hi all friends
I want understand programmaticaly that a tab control I create on a dlg has TCS_SCROLLOPPOSITE style or not . If you know please share with me .
Thanks alot .
|
|
|
|
|
Use GetStyle() and check the style bit you are interested in.
if ((GetStyle() & TCS_SCROLLOPPOSITE) == TCS_SCROLLOPPOSITE)
{
}
|
|
|
|
|
Am doing a find utility where am able to open all the child windows having the search text in the CListCtrl.
But am not able to set the focus (cursor) on the searched item in the particular child window. i use the following code for the selected item selection:-
list.SetItemState(nItem, LVIS_SELECTED, LVIS_SELECTED);
list.EnsureVisible( nItem, FALSE);
list.SetFocus();
Any clues please?
Thanks
Raji
|
|
|
|
|
Hi!
I have a Formview and in that i have many graphs. Onleftdblclick onany graph it zooms. Till here i don't have ne problem but the problem is that i can not hide the graphs and controls behind it, i.e when i click on the zoomed graph i can see the comtrols behind it. i want a method to hide all the controls exept th one zoomed and show them again when it restores...
can ne one help me????
if(bFullScreen)
{
this->SetActiveWindow();
this->SetWindowPos(&wndBottom, 1,1,1005,594,SWP_SHOWWINDOW);
// this->SetForegroundWindow();
// this->BringWindowToTop();
//this->MoveWindow(1,1,1005,594);
bFullScreen = false;
HWND hwnd = ::GetTopWindow(this->GetSafeHwnd());
while (hwnd)
{
hwnd = ::GetNextWindow(hwnd, GW_HWNDNEXT);
::EnableWindow(hwnd, FALSE);
}
}
else
{
this->MoveWindow(rectWnd);
bFullScreen = true;
}
CWnd::OnLButtonDblClk(nFlags, point);
i have the above code but it is'nt working....
Keyur Bhatnagar
|
|
|
|
|
Do you want to use ShowWindow ?
|
|
|
|
|
any way! i just want to hide the childs so that the processing for them continues my graph(real time plotiing) does,nt stop ploting
|
|
|
|
|
Your code is true also you cna use of EnumChildWindows for get child windows and use of ShowWindow for hide them.
|
|
|
|
|
Hey can u give me example for it????
i am using Enumchildwindows but it is'nt calling the callback function...
i don't know what am i doing wrong.......
Help me on this....
|
|
|
|
|
|
Hi
Can I viosualise Thread as
1. Multi-Tasking within a Process.
2. Some processing that is to/can be done OUT-OF-SEQUENCE inside a Process and is LIGHT-WEIGHTED is coded as thread.
That is what I all know about threads!
Hope to get some clear and enough info on it
Bye
pitchu
|
|
|
|
|
A thread doesn't have to be light weight. Every app has at least one thread.
Christian Graus - C++ MVP
|
|
|
|
|
wasim ahmad bhat wrote: That is what I all know about threads!
I suggest you get a good book or read a good article on threads, cause there is so much more to threads than those two lines.
I can only please one person a day... today is not your day
|
|
|
|