|
have you tried derek water's tip above.. maybe this could help you..
bernhard
""Politicians and diapers have one thing in common. They should both be changed regularly and for the same reason."
|
|
|
|
|
Resource leaks? What are those?
For those I'm pretty sure you need a tool like BoundsChecker or Purify.
If you use MFC, the CGdiObject-derived and CDC-derived classes, like CFont, CPaintDC, CPen, and CBrush clean themselves up via their destructors. This reduces your chances of having resource leaks. Still, if I had a GDI intensive app, I'd consider getting a tool to ensure it cleaned itself up properly.
Regards,
Alvaro
|
|
|
|
|
Though I go along with the others, specially the likes of bounds checker, I tend to build in a bit of quicky debugging. Afteral, you get told you have memory leaks so all you need to know is 'can my code exit without passing the cleanup' and 'does my clean up clean them all'.
Typically a node creation/deletion will follow the same few paths. If none of your memory is freed then that will be pretty obvious to fix, if only some are not freed then it is likely to be a program path problem
So, I count them in and count them out in the debug. Then print the debug value.
For example, lets say I have something like this below that is part of a xml scema parser. I have global counters,
#ifdef TRACE_TREE_MEMLEAKS
long m_Count_Tree_Leaks;
#endif
const int IN_SCHEMA_TREE = 1;
const int IN_XML_TREE = 0;
void SchemaTree::StoreSingleLineRootItem(LPCTSTR Line, int WhichTree)
#ifdef TRACE_TREE_MEMLEAKS
//include at every insert point. I had 5 ways into my two trees.
++m_Count_Tree_Leaks;
#endif
ElementTypeTree* ETType = new ElementTypeTree;
CString sLine, lSearchFor;
//fill item details
if(WhichTree == IN_SCHEMA_TREE)
m_DataTree.InsertDataItem(ETType,NULL);
else
m_XMLTree.InsertDataItem(ETType,NULL);
}
The multiline element type can create none or many subelements, so I would have these counted in too.
void SchemaTree::StoreMultiLineRootItem(int TreeLevel, LPCTSTR ItemString)
{
static CString RootItemName;
ElementTypeTree* ETType;
SubElements* subType;
CString sLine, lString, lSearchFor;
#ifdef TRACE_TREE_MEMLEAKS
//include at every insert point. I had 5 ways into my two trees.
++m_Count_Tree_Leaks;
++m_Count_Tree_Sub_Leaks;
#endif
ETType = new ...
subType = new ...
Then use
#ifdef TRACE_TREE_MEMLEAKS
--m_Count_Tree_Leaks;
--m_Count_Tree_Sub_Leaks;
#endif
at each point there are deleted.
I put this sort of stuff in from the beginning, it easy then, your not likely to miss one.
printing the debug counters values before exit (each possible exit) will tell you you have memory leaks, and which of your structures in is doing it.
We do it for the joy of seeing the users struggle.
|
|
|
|
|
This query is related to using an ActiveX control in VC++(Volo view Express of
AutoDesk AutoCad,free download availabe at
http://www3.autodesk.com. This is an ActiveX control
to view drawing files).
I used Volo View to view a drawing file on different computers.The volo view
always displays the same part of the drawing irrespective of the resolution of the
computers.
I have created a Dialog based application in VC++ and
inserted the Volo view Express into it(Through the Insert ActiveX control command).
As usual a wrapper class is created and inserted into project along with various
helper functions.I've also mapped the File Open menu to allow the user to select a drawing file.
If I now open the same drawing file which I had tested on different computers,the
drawing displayed is not similar to the one shown by volo view.The VC++ application displays
part of the drawing not shown by Volo. I want to know why the
drawing file is displayed differently when it is viewed through Volo view embedded in VC++
application.More over the VC++ application displays different parts of the drawing on different
computers.
How can I make the VC++ application to always display the same part of drawing irrespective
of the application running on different computers.
Any inputs in this regard would be of great help..
Thanks Ravi
|
|
|
|
|
Are the resolutions of the displays different. And do you size your drawing taking this into account.
10 pixels on 800x600 is bigger than on 1024x{whatsit}
We do it for the joy of seeing the users struggle.
|
|
|
|
|
Hi all,
How can i add Hot spot to my .HLP ?
Please write simple example ...
Thanks ...
My month article: Game programming by DirectX by Lan Mader.
Please visit in: www.geocities.com/hadi_rezaie/index.html
Hadi Rezaie
|
|
|
|
|
Help files are built from .RTF files. In the RTF file, you can create a link (or hot spot) from one topic to another using this syntax:
{\uldb Hot spot topic text}{\v HID_OF_TOPIC_TO_SHOW}
Various flags can be used as follows:
\uldb - jumps to this topic from the current topic
\ul - Link to a pop-up topic
Roger Allen
Sonork 100.10016
|
|
|
|
|
Hi Allen !
Can i use of it in my .HLP file ?
Because my help file is in .HLP mode (Context help)
and my help not .CHM mode !
So, can i use of it in .HLP ?
My month article: Game programming by DirectX by Lan Mader.
Please visit in: www.geocities.com/hadi_rezaie/index.html
Hadi Rezaie
|
|
|
|
|
Your applications .hlp file is compiled when your project is compiled (if any of the files have changed). If you look in the Hlp sub directory of your project, you should see some .rtf files call AfxPrint.rtf and AfxCore.rtf. These are the default help topic for a typical application. You need to edit one of these. I normaly do this in the VC editor, but when I open the file, I change the Open as option in the file open dialog to Text so it doesn't hide all the .rtf format strings.
If you open one of these files, you can add a new topic with a hot spot to a different topic in it. You will then need to re-compiler yout .hlp file and make sure its in the same directory as your applications .exe file.
You can compile the .hlp file manually yourself, by using the tool MS V6->MS VC tools->Help workshop You should then browse to your projects .hpj file in the Hlp directory. You can then access the options to compile the .hlp file when you do changes to the .rtf files. Once compiled copy the generated .hlp file to the release/debug directory and test it with your application.
Roger Allen
Sonork 100.10016
|
|
|
|
|
Thanks for your helps
Best Regards,
My month article: Game programming by DirectX by Lan Mader.
Please visit in: www.geocities.com/hadi_rezaie/index.html
Hadi Rezaie
|
|
|
|
|
Hi all,
How can i show Help Context icon in my dialog title bar ?
Please help me !
My month article: Game programming by DirectX by Lan Mader.
Please visit in: www.geocities.com/hadi_rezaie/index.html
Hadi Rezaie
|
|
|
|
|
To get the ? help icon in a dialog, in the resource editor you need to set the More styles - Context help check box. You need to do this when the dialog resouce is selected, not one on the controls on the dialog. Make sure also that the System menu option is also checked in the styles tab.
Roger Allen
Sonork 100.10016
|
|
|
|
|
Thanks for your helps !
My month article: Game programming by DirectX by Lan Mader.
Please visit in: www.geocities.com/hadi_rezaie/index.html
Hadi Rezaie
|
|
|
|
|
Hi All,
I have a pretty simple CEdit subclass that paints its background with a texture bitmap. When I use it in multi-line mode, with more text than will fit in the window, scrolling upward doesn't cause WM_ERASEBKGND to be sent, and so the top lines are drawn over the old content (yuk!).
I've tried handling WM_CTLCOLOR- doesn't make any difference. Any ideas?
Thanks
NB
|
|
|
|
|
can't you refresh the whole window? It doesn't work?
|
|
|
|
|
hi lucky...
that would be a perfect solution, but in response to what message?
|
|
|
|
|
I think you could refresh all the window by handling the ON_SCROLL message or something like that
|
|
|
|
|
Hello,
I am trying to repaint just a small rect of my dialog.. The dialog has a Bitmap background and I have a static text (timer) that gets updated every second.. The problem is when it updated the static text it doesnt repaint the background so I get a bunch of numbers placed over the top of one another.. Looks really bad.. I can do a RedrawWindow() and it will repaint correctly but it repaints the whold dialog box (causes flickering) looks very anoying.. Im trying to just repaint a rect but I need the rect to be repainted just as well as if I were to do a RedrawWindow() on the whole dialog box.. this is what I have tried.
CRgn rgn;
rgn.CreateRectRgn(17,44,29,13);
CRect rect(17,44,29,13);
RedrawWindow(&rect, &rgn, RDW_INVALIDATE | RDW_ERASENOW | RDW_UPDATENOW);
I have tried several different flags but none of this seems to do the same thing as plain old RedrawWindow();
Any Ideas?
Rob
|
|
|
|
|
If you provide a region pointer, the rect pointer is ignored. Have you tried RDW_ERASE instead of RDW_ERASENOW, which would give you the defaults exactly as if you'd just done RedrawWindow(); ?
Christian
After all, there's nothing wrong with an elite as long as I'm allowed to be part of it!! - Mike Burston Oct 23, 2001
|
|
|
|
|
I changed the rect pointer to a null and used the RDW_ERASE with the RDW_INVALIDATE and it still doesn't redraw like RedrawWindow with out any params.. strange.
Not sure what this isn't working.
Rob
|
|
|
|
|
For my next project, I'd like to be able to see how many keys I've typed over the years and be able to compare this measure of geekiness with others. I don't necessarily need to know what is typed (though that would help any stats ideas in the future). Can anybody point me in the right direction for learning the ropes with global hooks and keytraps in Win32? I'll probably have followup questions for you too...
Thanks...
(BTW, this is sort of like the old uptimes.org, but on a different slant )
-Jason
|
|
|
|
|
Hi,
I am trying to develop an administration client (GNU) for mysql and I am looking to develop an interface similar to mssql 2000. I am going to want to have dynamic content in the pages so static html files won't work. Does anyone have any suggestions how to approch it. I have tried http://www.codeguru.com/ieprogram/HtmlMemory.html except this causes problems when you deal with a large amount of HTML you flood out the LPSTR variable. Is there a better tutorial out there regarding this?
Is there a better way to apporch this, or do you think I am doing something wrong?
|
|
|
|
|
|
You may want to consider hosting the MSHTML component yourself and use the IPersistStreamInit Interface together with a memory stream.
Since this is a stream, it does not have the cap like the string version. I can't remember exactly but I think the cap is something like 1024 Kbytes?
Cheers
Sidney
|
|
|
|
|
Hello,
Just for educational purposes I am trying to write an MP3 player.. I have implemented the stop, play and pause buttons plus volume control and a few other things.. I'm stuck on trying to figure out how I can display or determine the length of a song in seconds (I've looked through codeproject, codeguru and MSDN).. Anyone know a good place to start or does anyone have any samples of code on how to determine how long a song is and display it in a string?
Thanks,
Rob
|
|
|
|