What is the best way to terminate an application? I usually just call exit(0); from within my view-class, but sometimes that generates an error message. Suggestions?
: What is the best way to terminate an application? I usually just call exit(0); from within my view-class, but sometimes that generates an error message. Suggestions? : : :
Hmm... I have used exit(1); and haven't got a single error. What does that number in exit argument mean? Has this something to do with this prob?
: : What is the best way to terminate an application? I usually just call exit(0); from within my view-class, but sometimes that generates an error message. Suggestions? : : : : : : : : Hmm... I have used exit(1); and haven't got a single error. What does that number in exit argument mean? Has this something to do with this prob? :
I don't think so. You should use exit(0); since that indicates EXIT_SUCCESS. exit(1) indicates EXIT_FAILURE.
I think my problem is that i don't clean up after my application. I have an App-Wizard-generated SDI-application and when I call exit(0); there is an error message that says that a pagefault has occured in MFC42.dll. I have tried using static linking and the problem seems to go away, but that's not a good solution since my programsize increases almost 4 times with static linking. Has anyone experienced similar problems?
Simply stop using the exit() function. It does work well for console programs, not for GUI ones. I don't use the MFC, but there will surely be a function (maybe named something like "AfxExit", "AfxExitProgram") which correctly ends the program. ________ [size=1][b][grey]Cold[/grey][blue]Shine[/blue][/b][/size]
: : : What is the best way to terminate an application? I usually just call exit(0); from within my view-class, but sometimes that generates an error message. Suggestions? : : : : : : : : : : : : : Hmm... I have used exit(1); and haven't got a single error. What does that number in exit argument mean? Has this something to do with this prob? : : : : I don't think so. You should use exit(0); since that indicates EXIT_SUCCESS. exit(1) indicates EXIT_FAILURE. : : I think my problem is that i don't clean up after my application. I have an App-Wizard-generated SDI-application and when I call exit(0); there is an error message that says that a pagefault has occured in MFC42.dll. I have tried using static linking and the problem seems to go away, but that's not a good solution since my programsize increases almost 4 times with static linking. Has anyone experienced similar problems? : : Use PostQuitMessage(0) instead, or close the main window of the MFC application.
: Simply stop using the exit() function. It does work well for console programs, not for GUI ones. I don't use the MFC, but there will surely be a function (maybe named something like "AfxExit", "AfxExitProgram") which correctly ends the program. : ________ : [size=1][b][grey]Cold[/grey][blue]Shine[/blue][/b][/size] : :
: one way to do it is : : AfxGetMainWnd()->SendMessage(WM_CLOSE, 0, 0); : : : Simply stop using the exit() function. It does work well for console programs, not for GUI ones. I don't use the MFC, but there will surely be a function (maybe named something like "AfxExit", "AfxExitProgram") which correctly ends the program. : : ________ : : [size=1][b][grey]Cold[/grey][blue]Shine[/blue][/b][/size] : : : : : : : :
Comments
:
:
:
Hmm... I have used exit(1); and haven't got a single error. What does that number in exit argument mean? Has this something to do with this prob?
: :
: :
: :
:
: Hmm... I have used exit(1); and haven't got a single error. What does that number in exit argument mean? Has this something to do with this prob?
:
I don't think so. You should use exit(0); since that indicates EXIT_SUCCESS. exit(1) indicates EXIT_FAILURE.
I think my problem is that i don't clean up after my application. I have an App-Wizard-generated SDI-application and when I call exit(0); there is an error message that says that a pagefault has occured in MFC42.dll. I have tried using static linking and the problem seems to go away, but that's not a good solution since my programsize increases almost 4 times with static linking. Has anyone experienced similar problems?
________
[size=1][b][grey]Cold[/grey][blue]Shine[/blue][/b][/size]
: : :
: : :
: : :
: :
: : Hmm... I have used exit(1); and haven't got a single error. What does that number in exit argument mean? Has this something to do with this prob?
: :
:
: I don't think so. You should use exit(0); since that indicates EXIT_SUCCESS. exit(1) indicates EXIT_FAILURE.
:
: I think my problem is that i don't clean up after my application. I have an App-Wizard-generated SDI-application and when I call exit(0); there is an error message that says that a pagefault has occured in MFC42.dll. I have tried using static linking and the problem seems to go away, but that's not a good solution since my programsize increases almost 4 times with static linking. Has anyone experienced similar problems?
:
:
Use PostQuitMessage(0) instead, or close the main window of the MFC application.
AfxGetMainWnd()->SendMessage(WM_CLOSE, 0, 0);
: Simply stop using the exit() function. It does work well for console programs, not for GUI ones. I don't use the MFC, but there will surely be a function (maybe named something like "AfxExit", "AfxExitProgram") which correctly ends the program.
: ________
: [size=1][b][grey]Cold[/grey][blue]Shine[/blue][/b][/size]
:
:
: one way to do it is
:
: AfxGetMainWnd()->SendMessage(WM_CLOSE, 0, 0);
:
: : Simply stop using the exit() function. It does work well for console programs, not for GUI ones. I don't use the MFC, but there will surely be a function (maybe named something like "AfxExit", "AfxExitProgram") which correctly ends the program.
: : ________
: : [size=1][b][grey]Cold[/grey][blue]Shine[/blue][/b][/size]
: :
: :
:
:
:
: