Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Canceling Printing in MS Common Dialog
Message
From
30/11/1999 19:42:58
 
 
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Miscellaneous
Thread ID:
00297176
Message ID:
00297184
Views:
35
>>Hi Everyone,
>>
>>I am using Microsoft´s Common Dialog activeX control to select printer settings before issueing a report. It seems to be that the CancelError property if set to .T., generates Error # 32755 if user selects Cancel command button, while in the printer properties dialog. In order to trap the error I wrote the following code:
>>
>>	On Error Do ErrHand
>>	thisform.oleMSCommonDialog.CancelError=.T.
>>	thisform.oleMSCommonDialog.ShowPrinter
>>	On Error
>>	thisform.oleCrystal.Destination=0
>>	thisform.oleCrystal.ReportFilename=cPath+'visitas.rpt'
>>	thisform.oleCrystal.PrintReport
>>	
>>For debugging purposes ErrHand is a PRG with the following code:
>>
>>	Procedure ErrHand
>>		wait window "Error 32755 has occured"
>>	Return
>>
>>
>>ErrHand routine is not being called, even if exiting Printer dialog with cancel button, that is, error message above is not displayed.
>>
>>How can I trap the error or cancel printing if user presses the cancel button ?
>
>Hmmm. If I set up an ON ERROR command, it works OK for me. Do you have some other kind of error handling for this form? It worked in both VFP5 & 6 both have their respective SP3's applied.

I also ran my test by bringing up the Printer Dialog from a command button. If you put error code there, it seems to work, too.

Code in the button Click event:
this.Parent.oleControl1.CancelError = .t.
this.Parent.oleControl1.ShowPrinter()

Code in the button Error event:
LPARAMETERS nError, cMethod, nLine
MessageBox('Error! '+STR(nError)+' '+cMethod+' '+STR(nLine))

It returned error 1429 in for my buttons Click event, line 2, the ShowPrinter call.
Fred
Microsoft Visual FoxPro MVP

foxcentral.net
Previous
Reply
Map
View

Click here to load this message in the networking platform