|
Not every leak Purify/BC detects is the true leak.
Some like: "NoTrack" ( or "NoMemoryTrack"!? ) and SetEnv, delayLoad has to do with MFC structure, others leaks inside CryptoApis, etc has to do with crappy MS coding.
|
|
|
|
|
In addition to what Brian said, some leaks are due to improper termination. Many termination leaks are due to how the leak detecting program monitors the DLL. In some cases, they do not, or cannot, check memory in the proper spot. Regardless, these are of no real concern.
I haven't used Purify, but they should have a filter file for each compiler and library used. Be aware that on a few occasions these programs will do a false detection. I have perfectly legitimate code that totally "stumps" BoundsChecker as well as other programs.
The leaks to be concerned about are those that happen while the program is running.
|
|
|
|
|
Any clues on how to trap the standard Window | Close All command? I need to close a number of modeless dialogs before continuing with the standard operation, which closes all open views.
I suppose I could just define my own IDC_WINDOW_CLOSE_ALL command, but it seems like it's a pain to inject this menu item into the standard Windows popup.
Thanks,
/ravi
Let's put "civil" back in "civilization"
Home | Articles | Freeware | Music
ravib@ravib.com
|
|
|
|
|
Well in ED I change the ID and do my own thing, but CWinApp::CloseAllDocuments(), CDocTemplate::CloseAllDocuments() might be of help.
Neville Franks, Author of ED for Windows. Free Trial at www.getsoft.com
|
|
|
|
|
Hi Neville,
Yes, that's my fallback solution. Do you know how to insert a custom menu item into the standard Windows popup (i.e. the one that contains an MFC generated list of view names)?
Thanks,
/ravi
Let's put "civil" back in "civilization"
Home | Articles | Freeware | Music
ravib@ravib.com
|
|
|
|
|
Hi Ravi,
Have a look at CMDIFrameWnd::GetWindowMenuPopup(HMENU hMenuBar).
Assuming you are using a Menu Resource why can't you just change it there.
Neville Franks, Author of ED for Windows. Free Trial at www.getsoft.com
|
|
|
|
|
Yikes, I must be getting senile! Just looked at my code and found I already have a handler for a custom ID_WINDOW_CLOSE_ALL menu item in all my view classes. I copied the handler (and the menu) to the mainframe. and added the code to close all open modeless dialogs, so all is well.
Thanks for your help!
/ravi
Let's put "civil" back in "civilization"
Home | Articles | Freeware | Music
ravib@ravib.com
|
|
|
|
|
I compiled reseditor using csc.exe. No problem. I even saved a test resource file with ".resources" extension successfully. It broke down unfortunately however when I tried to saved it as ".resx" format. Is there any place where I can download resource editor binary? I searched tucows, download.com, morpehus, microsoft msdn and google, no luck yet.
anyway, here's the problem, in case you wish to know:
See the end of this message for details on invoking
just-in-time (JIT) debugging instead of this dialog box.
************** Exception Text **************
System.NullReferenceException: Object reference not set to an instance of an object.
at System.Resources.ResXResourceWriter.Generate()
at System.Resources.ResXResourceWriter.Dispose(Boolean disposing)
at System.Resources.ResXResourceWriter.Dispose()
at System.Resources.ResXResourceWriter.Close()
at ResEditorComponents.ResEditor.WriteResXFile(String fileName) in C:\Program Files\Microsoft Visual Studio .NET\FrameworkSDK\Samples\Tutorials\resourcesandlocalization\reseditor\ResEditor.cs:line 519
at ResEditorComponents.ResEditor.SaveResources() in C:\Program Files\Microsoft Visual Studio .NET\FrameworkSDK\Samples\Tutorials\resourcesandlocalization\reseditor\ResEditor.cs:line 485
at ResEditorComponents.ResEditor.menuFileSave_Click(Object sender, EventArgs e) in C:\Program Files\Microsoft Visual Studio .NET\FrameworkSDK\Samples\Tutorials\resourcesandlocalization\reseditor\ResEditor.cs:line 469
at System.Windows.Forms.MenuItem.OnClick(EventArgs e)
at System.Windows.Forms.MenuItemData.Execute()
at System.Windows.Forms.Command.Invoke()
at System.Windows.Forms.Control.WmCommand(Message& m)
at System.Windows.Forms.Control.WndProc(Message& m)
at System.Windows.Forms.ScrollableControl.WndProc(Message& m)
at System.Windows.Forms.ContainerControl.WndProc(Message& m)
at System.Windows.Forms.Form.WndProc(Message& m)
at System.Windows.Forms.ControlNativeWindow.OnMessage(Message& m)
at System.Windows.Forms.ControlNativeWindow.WndProc(Message& m)
at System.Windows.Forms.NativeWindow.Callback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)
************** Loaded Assemblies **************
mscorlib
Assembly Version: 1.0.3300.0
Win32 Version: 1.0.3705.0
CodeBase: file:///c:/windows/microsoft.net/framework/v1.0.3705/mscorlib.dll
----------------------------------------
ResEditor
Assembly Version: 0.0.0.0
Win32 Version: 0.0.0.0
CodeBase: file:///C:/Program%20Files/Microsoft%20Visual%20Studio%20.NET/FrameworkSDK/Samples/Tutorials/resourcesandlocalization/reseditor/ResEditor.exe
----------------------------------------
System.Windows.Forms
Assembly Version: 1.0.3300.0
Win32 Version: 1.0.3705.0
CodeBase: file:///c:/windows/assembly/gac/system.windows.forms/1.0.3300.0__b77a5c561934e089/system.windows.forms.dll
----------------------------------------
System
Assembly Version: 1.0.3300.0
Win32 Version: 1.0.3705.0
CodeBase: file:///c:/windows/assembly/gac/system/1.0.3300.0__b77a5c561934e089/system.dll
----------------------------------------
System.Drawing
Assembly Version: 1.0.3300.0
Win32 Version: 1.0.3705.0
CodeBase: file:///c:/windows/assembly/gac/system.drawing/1.0.3300.0__b03f5f7f11d50a3a/system.drawing.dll
----------------------------------------
System.Xml
Assembly Version: 1.0.3300.0
Win32 Version: 1.0.3705.0
CodeBase: file:///c:/windows/assembly/gac/system.xml/1.0.3300.0__b77a5c561934e089/system.xml.dll
----------------------------------------
************** JIT Debugging **************
To enable just in time (JIT) debugging, the config file for this
application or machine (machine.config) must have the
jitDebugging value set in the system.windows.forms section.
The application must also be compiled with debugging
enabled.
For example:
<configuration>
<system.windows.forms jitdebugging="true">
When JIT debugging is enabled, any unhandled exception
will be sent to the JIT debugger registered on the machine
rather than being handled by this dialog.
norm
|
|
|
|
|
Any one can help me how to change my desktop wallpaper and add a desktop items to active desktop( Icon, web,...) ?
----------------------
Coding for lv,lv & di
|
|
|
|
|
hi.
you can look this example.
http://www.codeproject.com/tools/wallpaperq.asp?target=change%7Cdesktop%7Cwallpaper
good work!!;)
|
|
|
|
|
|
Hi, all
I have created a RichEdit box (version 1.0) using regular windows API (no MFC) but I can’t seem to format (using the SendMessage() function) any part of the text in the control. I have tested both formatting the paragraphs (PARAMFORMAT structure) and characters (CHARFORMAT structure) but nothing seems to get displayed. The return values (from both EM_SETPARAFORMAT and EM_SETCHARFORMAT flags) are nonzero, which indicates success. I know that I am setting the cbSize and the dwMask structure members correctly because after setting the format, I use EM_GETPARAFORMAT and EM_GETCHARFORMAT flags to check if the changes was actually made, and it is (but just not displayed). This experience is really strange, I really don’t know what I am doing wrong or missing. And I can’t seem to find any examples on formatting text in a Rich Edit without using MFC. Any ideas on how to solve this or find any examples are greatly appreciated.
Thanks in advance
Aidman » over and out
We haven't inherited Earth from our parents, instead we have borrowed her from our children; an old Indian saying.
|
|
|
|
|
hehe... I found the problem, when I declared the PARAMFORMAT and the CHARMFORMAT structures I forgot setting them to zero, which caused the variable members (who wasn’t later set to any specific value) to have unpredictable values. Anyways it was a clumsy mistake
Aidman » over and out
We haven't inherited Earth from our parents, instead we have borrowed her from our children; an old Indian saying.
|
|
|
|
|
new to win32 api programming and am using the free borland tools.
i want to ensure i have the latest headers/libraries that will allow me to target 2k & xp but not clear on how to use msft's platform sdk update and borland to ensure they play well together.
advise from anyone who's gone down this road before?
|
|
|
|
|
Hi everyone !
Well, I have heard that the MFC runtime used a hook to dynamically link a
component to its window procedure. I know that it's the best way to do it,
but Microsoft itself advises the developers to use hooks in their
applications only for debugging purposes, because it dramatically slows
the programs down... What about MFC programs, are they much slower than
their raw API equivalents ?
Thanks in advance,
Mark
|
|
|
|
|
Well, as far as I know that MFC uses window subclassing to override the default WndProc. Hooking is usually used to install the MFC WndProc to the created window. I dont know what hooks exaclty, but definitely not WH_CALLWNDPROC hook or anything like it, which involve notification of frequent events. Usually WH_CBT is used, which can notify the hooking application about creation of windows.
Another thing, there is a difference of local hooking used in this process and global hooking in which the hook is installed over the whole system.
To sum up, the hooking is used just to initiate subclassing and it's local to the process. Subclassing doesnt degrade performance (actually it is done using APIs). So if there existed a degreade on performance of MFC application I think hooking wont be the reason.
Am saying this with accordance to my knowledge, hope if there is anything wrong someone would correct it
|
|
|
|
|
The hook that MFC uses is only installed for the time it takes to create the window. Basically, MFC installs the hook, creates the window, and uninstalls the hook. The hook has basically no influence on the program or the system. Incidentally, it's a thread-specific hook, so it would not slow down the system anyway.
Hope this helps,
Ryan "Punctuality is only a virtue for those who aren't smart enough to think of good excuses for being late" John Nichol "Point Of Impact"
|
|
|
|
|
Thanks alot for your replies, mates !
|
|
|
|
|
Hi,
Is there a way to detect from a setup program whether or not MFC is installed, and download/install it only if it isn't?
Such as is with the detecting of MSI's installer?
I do know that I can detect if it's there an close the setup application, but don't know if it's possible to automatically download it.
Thanks,
Shutter
|
|
|
|
|
You could search for the mfc dll (the version that your program uses). You could put the installation program on your ftp site and download and run it if needed.
Cathy
Life's uncertain, have dessert first!
|
|
|
|
|
Hello -
I have a CWnd derived class which I am creating in a MFC SDI app. I create it hidden, and its job is to handle some messages generated by the back end of my app. If I fire up the app and don't touch it, everything runs fine, and all messages are received by this class. However, as soon as I start doing anything in the GUI (i.e. more messages are generated), then some of messages generated by my back end are posted but not received.
Here is how I create the class:
m_pMyWnd->CreateEx(0, _T("STATIC"), _T(""), 0, CRect(0,0, 100, 100), NULL, 0);
and another chunk of code does a postmessage to this window, but it doesnt receive the message, even though PostMessage() succeeds.
Is there a different way I should create this window to ensure that my messages will make it through?
Thanks!
Marcus Spitzmiller
"Why must life be so hard? Why must I fail at every attempt at masonry?" - Homer
|
|
|
|
|
It sounds like you really want a multi-threaded application.
Cathy
Life's uncertain, have dessert first!
|
|
|
|
|
Care to explain? This app is quite multi-threaded already, and the section posting the messages is in its own thread...
Marcus Spitzmiller
"Why must life be so hard? Why must I fail at every attempt at masonry?" - Homer
|
|
|
|
|
I thought maybe that was the problem, that you were doing it in the same thread.
I had to do something like this to get my messages through:
<br />
while (theApp.m_pMainWnd && PeekMessage(&msg, theApp.m_pMainWnd->m_hWnd, 0, 0, PM_NOREMOVE))<br />
{<br />
if (!theApp.PumpMessage())<br />
{<br />
PostQuitMessage(0);<br />
return TRUE;<br />
}<br />
}<br />
Cathy
Life's uncertain, have dessert first!
|
|
|
|
|
First, messages sent though PostMessage are not guaranteed to make it through. In practice, however, only in very extreme circumstances (slow machine, fast input) do they not get through.
Also note that PostMessage() will only fail if the window handle is incorrect or some other critical problem. Whether or not the message will be received has no bearing on the success of the call. (See SDK documentation.)
I question the use of a hidden window. I suspect the messages are being reflected somewhere. Why not just use the main window and use USER messages?
|
|
|
|