CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 11 of 11
  1. #1
    Join Date
    Mar 2004
    Posts
    31

    Problems with MFC's .exe

    Greetings everyone,
    I have written a program for my project using the MFC (exe). I could run my program perfectly using the debug mode. Then I copied the exe (release) out and pasted it in the other places (with all the database and components needed added in the same directory). So next I clicked on the exe and my program started loading. Everything works fine but when I clicked on one of my functions, error message coming out, the whole program crashes or something.
    For that function I'm doing a shortest path algorithm. I am using a database (.mdb) to search for the shortest path. I believe the problem is either cannot link to database or when I click on the nodes, the exe cannot read the value of the node. But it all works fine in my program(i.e. in the debug mode). Anyone has any idea what the problem is and how to solve it?

    Any suggestion or solution is appreciated.

    Cheers.

    -one-

  2. #2
    Join Date
    Mar 2004
    Posts
    31
    Could the problem come from the database accessing. I'm using ODBC format. But when I run my program in debug mode, I can run perfectly. This really amuse me. Could anyone tell me is there any difference between the debug version and the release version??
    Thank you for any comment.

    Cheers

    -one-

  3. #3
    Join Date
    Dec 2002
    Posts
    214
    maybe the problem is the connect string which you used to open the database.

    note that the filename of the database is base on current directory ( which may not be the location where the exe file lies).

  4. #4
    Join Date
    May 2000
    Location
    KY, USA
    Posts
    18,652
    Take a look at the following FAQ. In addition:

  5. #5
    Join Date
    Mar 2004
    Posts
    31
    I have every of my database in the same directory. If I use the debug version exe to run, I don't have any problem. But when I use the release version exe, I cannot run the function. I think it has something to do with the mfc42.dll and odbc32.dll. Maybe windows XP isn't compatible with this old ODBC format database? I have no single clue.
    What's your opinion??
    Thanks alot wuyh.

    Cheers.

    -one-

  6. #6
    Join Date
    Mar 2004
    Posts
    31
    Thanks alot Andreas Masurs. I will look through it and try to find out the problem.


    cheers.

    -one-

  7. #7
    Join Date
    Mar 2004
    Posts
    31
    I still cannot get the problem solved. I tried to find the crash information from the MAP file, but the address that I found is from a function that I never use (which means I just leave it there and there's no even any link to it).
    I looked up at the error message shown when I run my function. And the following is what I see:

    ModName: mfc42.dll
    ModVer: 6.0.8665.0 Offset: 00004045

    Is it anything to do with the mfc42.dll? Running in the debug version doesn't have this problem.

    Thanks for any help.

    cheers.

    -one-

  8. #8
    Join Date
    Apr 1999
    Posts
    27,449
    What is the call stack when the crash occurs? The call stack shows you the series of functions that lead up to the crash.

    Also, if you rebuild the release version with debugging information, the crash should occur and you'll be able to use the VC++ debugger to find the problem.

    Regards,

    Paul McKenzie

  9. #9
    Join Date
    Mar 2004
    Posts
    31
    Unhandled exception in test.exe (MFC42.DLL):0xC0000005: Access Violation

    This is what I got from the error message. I think the problem is to link the database and edit the database coz my other functions work fine.

    Any idea anyone? Thanks for all the help.

    Cheers.

    -one-

  10. #10
    Join Date
    Oct 2000
    Location
    Ottawa, CANADA. (CNADA ROCKS!!)
    Posts
    1,895
    put a try catch block and put up an message box with the error info.
    and Canada rocks!! Peace bro.

  11. #11
    Join Date
    Apr 1999
    Posts
    27,449
    Originally posted by Rivaldo
    Unhandled exception in test.exe (MFC42.DLL):0xC0000005: Access Violation

    This is what I got from the error message. I think the problem is to link the database and edit the database coz my other functions work fine.

    Any idea anyone? Thanks for all the help.

    Cheers.

    -one-
    What about the call stack? When an exception occurs (and if you compiled with debug information turned on), you should get a dialog with an OK and Cancel button, where "Cancel" allows you to debug the application. Did you get this message box? If you did, press Cancel, it will take you to the debugger. Now look at the call stack. What are the functions that led to the call to the MFC42.dll function?

    Regards,

    Paul McKenzie

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