-
January 18th, 2010, 10:47 AM
#16
Re: How to find problem in MFC program
Hi Norm,
I've been trying to convert the Easybridge program to Visual Studio 2008 format so that I can debug it. It compiles now, but I have a few linker problems to sort out still.
Once I can build it, I'll run it through a program called "Memory Validator", which is quite useful for this type of problem. Hopefully it will show the line of code where the GDI object is being created.
The alternative is to examine the code for paths that would allow creation of a card object which is not subsequently deleted.
Alan
-
January 18th, 2010, 11:57 AM
#17
Re: How to find problem in MFC program
Originally Posted by Norm
May I suggest you change your source code so that you aren't coding using the broken VC 6.0 syntax, especially the loops. Most people are using Visual Studio 2005 and above, and the code below causes syntax errors.
Code:
for (int i = 0; i < whatever; ++i)
{
// whatever
}
for (i = 0; i < whatever2; ++i )
{
}
The VC 6.0 compiler is broken. The line in red is not legal C++, since the scope of the "i" variable ends with the first for() loop. You have a lot of places in your code where stuff like this is done.
Change this so that the declaration of "i: is outside the loop:
Code:
int i;
for (i = 0; i < whatever; ++i)
{
// whatever
}
for (i = 0; i < whatever2; ++i )
{
}
Then there is no problem.
Regards,
Paul McKenzie
-
January 18th, 2010, 02:03 PM
#18
Re: How to find problem in MFC program
Originally Posted by Paul McKenzie
May I suggest you change your source code so that you aren't coding using the broken VC 6.0 syntax, especially the loops. Most people are using Visual Studio 2005 and above, and the code below causes syntax errors.
That issue alone accounts for over 600 errors in the compile.
To norm: Sorry, but I don't have the time or inclination to fix all of those in order to get a clean compile to try and track down the resource leaks.
-
January 19th, 2010, 09:04 AM
#19
Re: How to find problem in MFC program
Thanks to everyone for the info. I didn't realize that VC 6 supported invalid syntax.
I've solved the problem, thanks to OReubens' post re looking at GDI Objects in the task manager.
I found a function that did a GetDC() in the start and a ReleaseDC() at the end AND with a return in the middle without a ReleaseDC(). Adding a ReleaseDC() before the return fixed it.
Norm
-
January 29th, 2010, 03:20 AM
#20
Re: [RESOLVED] How to find problem in MFC program
Hi Norm,
Since I'm interested in Bridge, I've ported the original Easybridge source to Visual Studio 2008, fixing up the compile issues, and removing the dependency on the CCJ library, which doesn't seem to be available anymore.
It seems to run fine, I'll now take a look at the changes you've made and add them in as well.
Alan
-
February 4th, 2010, 09:35 AM
#21
Re: [RESOLVED] How to find problem in MFC program
Alan,
Could you show me how to remove the dependency on the CJ609Lib.dll?
Thanks,
Norm
Norm
-
February 4th, 2010, 10:48 AM
#22
Re: [RESOLVED] How to find problem in MFC program
Originally Posted by alanjhd08
and removing the dependency on the CCJ library, which doesn't seem to be available anymore.
It's still around.
I don't want to give away the name, but you will find it doing a google search for CodeJ*** (you fill in the stars).
It used to be free when it was first developed, but no longer.
Regards,
Paul McKenzie
-
February 4th, 2010, 12:11 PM
#23
Re: [RESOLVED] How to find problem in MFC program
Hi Norm,
I couldn't find a current copy of the Code Joxxxxx library CJ609lib.dll, or source to build a new one, so decided it was best to take it out.
Basically, I replaced all references to the CCJ classes with the class which they inherited from, e.g. replace CCJFlatComboBox with CComboBox. However, for CCJControlBar, I replaced it with a custom class called CToolBarEx.
I took out all the uses of CCJHyperLink rather than replace them, since they didn't seem to be essential. If you still need that feature, you could find a different class to do the same thing.
Alan
Last edited by alanjhd08; February 4th, 2010 at 12:13 PM.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|