CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Page 2 of 2 FirstFirst 12
Results 16 to 23 of 23
  1. #16
    Join Date
    Aug 2008
    Location
    Scotland
    Posts
    379

    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

  2. #17
    Join Date
    Apr 1999
    Posts
    27,449

    Re: How to find problem in MFC program

    Quote Originally Posted by Norm View Post
    hoxsiew,
    Here's a link to my site with the parts for the EasyBridge program:
    http://sites.google.com/site/normsst...s-to-be-shared
    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

  3. #18
    Join Date
    Feb 2005
    Posts
    2,160

    Re: How to find problem in MFC program

    Quote Originally Posted by Paul McKenzie View Post
    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.

  4. #19
    Join Date
    Jun 1999
    Location
    Eastern Florida
    Posts
    3,877

    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

  5. #20
    Join Date
    Aug 2008
    Location
    Scotland
    Posts
    379

    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

  6. #21
    Join Date
    Jun 1999
    Location
    Eastern Florida
    Posts
    3,877

    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

  7. #22
    Join Date
    Apr 1999
    Posts
    27,449

    Re: [RESOLVED] How to find problem in MFC program

    Quote Originally Posted by alanjhd08 View Post
    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

  8. #23
    Join Date
    Aug 2008
    Location
    Scotland
    Posts
    379

    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.

Page 2 of 2 FirstFirst 12

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured