|
There is always the chance that due to bugs in your software memory is getting freed in debug build and not in release. The usual cause of this is uninitialized variables in routines. Another cause if writing past the end of allocated memory.
Tim Smith
I know what you're thinking punk, you're thinking did he spell check this document? Well, to tell you the truth I kinda forgot myself in all this excitement. But being this here's CodeProject, the most powerful forums in the world and would blow your head clean off, you've got to ask yourself one question, Do I feel lucky? Well do ya punk?
|
|
|
|
|
Any known memory issues with maps in the MS STL library?
>>>-----> MikeO
|
|
|
|
|
I think so. Check the updates at Dinkumware. IIRC it's at
http://www.dinkumware.com/vc_fixes.html
Regarding the memory drop when minimizing: As already pointed out it's the working set that drops. The reason for this is that every time you minimize an application, Windows does what in effect is like calling SetProcessWorkingSetSize(GetCurrentProcess(), -1, -1); from within the app itself.
|
|
|
|
|
Easy question, this is.
I want to start a function after a CDialog appears on the screen, after the initialisation and paint functions that is. What message do I use, or which function do I deprecate?
It's a bit like the windowOpened(WindowEvent e) java-equivalent.
I've tried several functions and messages (like WM_SHOWWINDOW), but they all appeared before the dialog showed up.
[VISUAL STUDIO 6.0] [MFC] [WIN98/2]
Bluute tette!
|
|
|
|
|
Try to handle first occurence of WM_ENTERIDLE message. It should be sent after your dialog had been displayed.
Martin
|
|
|
|
|
How can I change the CDialog message filter to a message filter for Window? Because ENTERIDLE is a Window-message, not a CDialog-message.
[VISUAL STUDIO 6.0] [MFC] [WIN98/2]
Bluute tette!
|
|
|
|
|
Oeps, too hasty. Forgot the clw. Never mind.
[VISUAL STUDIO 6.0] [MFC] [WIN98/2]
Bluute tette!
|
|
|
|
|
I am sorry, I did not realise, WM_ENTRIDLE does not work in CDialog, and you cannot use. Instead of that, you can use WM_KICKIDLE:
1. Include #include <afxpriv.h> to your dialog cpp file.
2. add ON_MESSAGE(WM_KICKIDLE, OnKickIdle) to your message map
3. add function LRESULT OnKickIdle(WPARAM, LPARAM lCount); to your dialog.
It will work in the same way as WM_ENTRIDLE.
Martin
|
|
|
|
|
PostMessage(WM_USER+1) from OnInitDialog()
Now in the handler for WM_USER+1, you can do your stuff.
You'll have to add the message macros manually.
Nish
Regards,
Nish
Native CPian.
Born and brought up on CP.
With the CP blood in him.
|
|
|
|
|
I Need to get the file size of a file,
Anyone ho now???
\GoLa
|
|
|
|
|
|
Thanks but I need to use FindNextFile do you now how???
\GoLa
|
|
|
|
|
Like this?
int Size;
CFileFind finder;
CString FileType("*.TYP");
while (BOOL Found = finder.FindFile(FileType)) {
Found = finder.FindNextFile();
if (Found) Size = finder.GetLength();
}
>>>-----> MikeO
|
|
|
|
|
Is better in that mode:
int Size;
CFileFind finder;
CString FileType("*.TYP");
finder.FindFile(FileType)
while(Found)
{
Found = finder.FindNextFile();
Size = finder.GetLength();
}
Olways when you need to know any propiertie of a file that you found, you need to do FindNextFind
Best Regrds
Carlos Antollini.
www.wanakostudios.com
Sonork ID 100.10529 cantollini
|
|
|
|
|
Carlos Antollini wrote:
int Size;
CFileFind finder;
CString FileType("*.TYP");
finder.FindFile(FileType)
while(Found)
{
Found = finder.FindNextFile();
Size = finder.GetLength();
}
Hi Carlos,
Looking things over I think we both left some issues dangling. Let me try one more time:
BOOL Found;
CFileFind finder;
CString FileType("*.TYP");
Found = finder.FindFile(FileType)
while(Found)
{
Found = finder.FindNextFile();
Size = finder.GetLength();
}
When Found changes to false is finder still valid? I can never remember exactly how that works.
>>>-----> MikeO
|
|
|
|
|
Mike Osbahr wrote:
When Found changes to false is finder still valid? I can never remember exactly how that works.
Yes is true...
When you need to ask about any property of the file that you found, like name, size, extension, attributes, you before must to do FindNextFile. You dont must worry about the result of FindNextFile...
For example in the MSDN read the Remarks section of CFileFind::GetFilePath,
Regards
Carlos Antollini.
www.wanakostudios.com
Sonork ID 100.10529 cantollini
|
|
|
|
|
from http://www.codeproject.com/file/sadirread.asp
WIN32_FIND_DATA FindFileData;
HANDLE hFind;
if ((hFind = FindFirstFile(fullPath, &FindFileData))!=INVALID_HANDLE_VALUE)
{
if ((FindFileData.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY)!=FILE_ATTRIBUTE_DIRECTORY)
{
size = ((unsigned __int64)FindFileData.nFileSizeHigh * ((unsigned __int64)MAXDWORD+1)) + (unsigned __int64)FindFileData.nFileSizeLow;
}
}
and, of course the FindNextFile loop comes right below this.
-c
Cheap oil. It's worth it!
|
|
|
|
|
Is the Following better?
int nSize;
CFileFind finder;
CString FileType("*.TYP");
finder.FindFile(FileType)
while(Found)
{
Found = finder.FindNextFile();
if(finder.IsDots() || finder.IsDirectory())
continue;
nSize = finder.GetLength();
}
Cheers
Carlos Antollini.
www.wanakostudios.com
Sonork ID 100.10529 cantollini
|
|
|
|
|
not if the original poster wants to use FindNextFile, not CFileFinder.
-c
Cheap oil. It's worth it!
|
|
|
|
|
Chris.
Yes is true...
The original message doesn't specify if he wants to use CFindFile::FindNextFile or ::FindNextFile...
You have the true, I don't why but always I think in MFC...
Regards....
Carlos Antollini.
www.wanakostudios.com
Sonork ID 100.10529 cantollini
|
|
|
|
|
and i always think in standard C. i originally did this with _findfirst, _findnext. i didn't even know there was a CFindFile class.
-c
Cheap oil. It's worth it!
|
|
|
|
|
Hi all ,
outside of OnPaint()I call in other function CDc* pDc = GetDc().
Sometimes its returns NULL.
Why?????????
Aizik Yair
Software Engineer
|
|
|
|
|
I found the reason.
I need call ReleaseDc() each time i use GetDC()
Aizik Yair
Software Engineer
|
|
|
|
|
I have changed some the default menu settings in my app, but now the Exit button does not work. I did remap it but thats because I wanted to do some cleaning up before it exited.
I thought the default behaviour was to map to WinApp::ExitInstance but that doesn't work.
does anyone know the default Exit function which VisC++ automatically maps the Exit button to.
cheers
Asim.
.........
I'd rather be rich than stupid.
|
|
|
|
|
The default exit process is triggered by sending WM_CLOSE to the main frame window (this is what CWinApp:OnExitApp does.)
Joaquín M López Muñoz
Telefónica, Investigación y Desarrollo
|
|
|
|