Stephan
April 28th, 1999, 10:02 AM
Good Morning
I want my Application to close as soon as the user presses either the CLOSE or the PRINT button in the PRINT PREVIEW MODE.
The whole idea here is that if the user has any pages selected to be printed the pages must first be printed, before the app closes.
Normal logic had me put the following line in my OnEndPrinting Function
AfxGetMainWnd()->PostMessage(WM_COMMAND,ID_APP_EXIT);
This works as I can close my application, but I am running into proplems, pressing the PRINT Button on the Preview Screen.
It will prints only one page, and then I will receive tyhe following error
PROGRAM HAS PERFORMED AN ILLEGAL OPERATION AND WILL BE CLOSED DOWN.
Debugging tells me that I have AN UNHANDLED EXCEPTION SHARED VIOLATION.
This problems only happens when I press the Print Button, and the normal close button on the preview screen will close my app nicely.
Any suggestions would be greatly appreciated.
Regards
Stephan
I want my Application to close as soon as the user presses either the CLOSE or the PRINT button in the PRINT PREVIEW MODE.
The whole idea here is that if the user has any pages selected to be printed the pages must first be printed, before the app closes.
Normal logic had me put the following line in my OnEndPrinting Function
AfxGetMainWnd()->PostMessage(WM_COMMAND,ID_APP_EXIT);
This works as I can close my application, but I am running into proplems, pressing the PRINT Button on the Preview Screen.
It will prints only one page, and then I will receive tyhe following error
PROGRAM HAS PERFORMED AN ILLEGAL OPERATION AND WILL BE CLOSED DOWN.
Debugging tells me that I have AN UNHANDLED EXCEPTION SHARED VIOLATION.
This problems only happens when I press the Print Button, and the normal close button on the preview screen will close my app nicely.
Any suggestions would be greatly appreciated.
Regards
Stephan