|
pavanbabut wrote: Is there something I am doing wrong??
As long as you are freeing all memory that you allocate, then no
"Do you know what it's like to fall in the mud and get kicked... in the head... with an iron boot?
Of course you don't, no one does. It never happens. It's a dumb question... skip it."
|
|
|
|
|
You can make calls to GetProcessWorkingSetSize and GlobalMemoryStatus to see if the numbers are changing.
|
|
|
|
|
Whenever I check it, it is freeing only half of the allocated size. But it frees the whole allocated memory when I deallocate it at the time of terminating the application, not while 'm running the application.
-Pavan.
|
|
|
|
|
How are you checking this? There's no accurate way that I know of.
Try this if you'd like:
MEMORYSTATUS OrigMemoryStat;
::GlobalMemoryStatus(&PrevMemoryStat);
TRACE(_T("********************************\n"));
for (int i = 0; i < 100; ++i)
{
HGLOBAL hGlobal = ::GlobalAlloc(GHND, 2000);
::GlobalFree(hGlobal);
MEMORYSTATUS MemoryStat;
::GlobalMemoryStatus(&MemoryStat);
TRACE(_T("********************************\n"));
TRACE(_T("** Delta dwAvailPhys %li Bytes\n"), (long)MemoryStat.dwAvailPhys - (long)OrigMemoryStat.dwAvailPhys);
TRACE(_T("** Delta dwAvailVirtual %li Bytes\n"), (long)MemoryStat.dwAvailVirtual - (long)OrigMemoryStat.dwAvailVirtual);
}
TRACE(_T("********************************\n"));
Trust the OS
"Do you know what it's like to fall in the mud and get kicked... in the head... with an iron boot?
Of course you don't, no one does. It never happens. It's a dumb question... skip it."
|
|
|
|
|
Ok, I figured out the problem. Once I allocate the memory, I am saving data into the variable by calling another function, in this process I am allocating more memory to another variable to hold a bitmap data, which is not being deallocated later and its piling up.
-Pavan.
|
|
|
|
|
|
Nice article... thanks..
|
|
|
|
|
|
Anil K P wrote: While trying, I get it as RGB(205,205,205) which is White.
More of a gray.
"Approved Workmen Are Not Ashamed" - 2 Timothy 2:15
"Judge not by the eye but by the heart." - Native American Proverb
|
|
|
|
|
Anil K P wrote: I need to get the background color of an active window. While trying, I get it as RGB(205,205,205) which is White
How are you doing this?
"Do you know what it's like to fall in the mud and get kicked... in the head... with an iron boot?
Of course you don't, no one does. It never happens. It's a dumb question... skip it."
|
|
|
|
|
Anil K P wrote: RGB(205,205,205) which is White
wrong, white is RGB(255, 255, 255)
|
|
|
|
|
|
Bookmarked/Favorited. Thanks!
Mark
"Do you know what it's like to fall in the mud and get kicked... in the head... with an iron boot?
Of course you don't, no one does. It never happens. It's a dumb question... skip it."
|
|
|
|
|
|
I was too searching for the same
Thanks
|
|
|
|
|
|
I am wondering if anyone knows a reliable way using GDI to detect whether an HFONT has unicode support?
|
|
|
|
|
Does the GetFontUnicodeRanges() API help to determine Unicode support for a font?
CClientDC dc(this);
CFont font;
VERIFY(font.CreatePointFont(120, _T("Arial Unicode MS"), &dc));
CFont* def_font = dc.SelectObject(&font);
DWORD dwGlyphSetSize = ::GetFontUnicodeRanges(dc, 0);
GLYPHSET *pGlyphSet = (GLYPHSET *)new BYTE[dwGlyphSetSize];
::GetFontUnicodeRanges(dc, pGlyphSet);
delete[] (BYTE *)pGlyphSet;
dc.SelectObject(def_font);
"Do you know what it's like to fall in the mud and get kicked... in the head... with an iron boot?
Of course you don't, no one does. It never happens. It's a dumb question... skip it."
|
|
|
|
|
Thanks Mark
I looked into that API call, however the other stipulation that I forgot to mention is that it has to work with windows 98. Unfortunatly that call only works for 2000 and up.
If there is any other way that you know of?
Thanks again Mark
Dave
|
|
|
|
|
Hmmm, maybe this KB article will help: Unicode support in Windows 95 and Windows 98[^]
Mark
"Do you know what it's like to fall in the mud and get kicked... in the head... with an iron boot?
Of course you don't, no one does. It never happens. It's a dumb question... skip it."
|
|
|
|
|
I have a DefWindowProc() function to catch unhandled messages. This function returns an LRESULT. I have a switch statement and in some cases I call CWnd::DefWindowProc(). So I simply return the result of the call to CWnd::DefWindowProc(). In other cases, I handle the message.
What should the value of LRESULT be when I handle the message?
|
|
|
|
|
Depends on the message. The documentation will tell you if the message needs a certain return value. If it does not then simply return zero.
You may be right I may be crazy -- Billy Joel --
Within you lies the power for good, use it!!!
|
|
|
|
|
Per MSDN:
The return value is the result of the message processing and depends on the message sent.
"Approved Workmen Are Not Ashamed" - 2 Timothy 2:15
"Judge not by the eye but by the heart." - Native American Proverb
|
|
|
|
|
Is there a way to make the Save File Dialog have an uneditable directory path or do I have to create a dialog from scratch to do this?
|
|
|
|
|
What does the word "Uneditable" mean?
|
|
|
|