User (Legacy) Posted March 8, 2005 Report Posted March 8, 2005 In a VB exe I am trying to capture the results of the Print Dialog using the Common dialog for printers. I have two reports printing, one from Crystal and the other the Chart from ChartFx. What I want to do is to wait for the user to press either the Print button or the Cancel button from the common dialog window for printers and then either print both the report and graph or do nothing. What I do not understand yet, is that when the user presses the Printer icon from the toolbar, I get two dialog windows popping up, one after the other. What I have done is put code in the Internalcommand method of Chartfx1 like this: frmReport.ChartFX1.Printer.hDC = frmReport.CommonDialog1.hDC frmReport.CommonDialog1.ShowPrinter If wParam = 29442 Or wParam = 29443 Then On Error GoTo cancel frmReport.CommonDialog1.CancelError = True If lShowCriteriaPage Then lcrCriteriaReport.PrintOut False End If End If cancel: On Error GoTo 0 Exit Sub I guess the question is how do I shut down the Print Dialog window that Chartfx is producing and also control the response from the user, Print or Cancel? Thanks, Joe
Software FX Posted March 8, 2005 Report Posted March 8, 2005 To stop the default processing of the InternalCommand (sshowing the Print Dialog) simply assign: nRes = 1 In your Event Handler. As for determining whether the user pressed Ok or Canclel in the Dialog YOU are displaying, I beleive the ShowPrinter method return a value that tells you this. FP SFX "Joe Glen" <jglen@quadramed.com> wrote in message news:z48cR8BJFHA.1924@webserver3.softwarefx.com... > In a VB exe I am trying to capture the results of the Print Dialog using > the > Common dialog for printers. I have two reports printing, one from Crystal > and the other the Chart from ChartFx. What I want to do is to wait for > the > user to press either the Print button or the Cancel button from the common > dialog window for printers and then either print both the report and graph > or do nothing. What I do not understand yet, is that when the user > presses > the Printer icon from the toolbar, I get two dialog windows popping up, > one > after the other. What I have done is put code in the Internalcommand > method > of Chartfx1 like this: > > frmReport.ChartFX1.Printer.hDC = frmReport.CommonDialog1.hDC > frmReport.CommonDialog1.ShowPrinter > > If wParam = 29442 Or wParam = 29443 Then > On Error GoTo cancel > frmReport.CommonDialog1.CancelError = True > If lShowCriteriaPage Then > lcrCriteriaReport.PrintOut False > End If > End If > > cancel: > On Error GoTo 0 > Exit Sub > > I guess the question is how do I shut down the Print Dialog window that > Chartfx is producing and also control the response from the user, Print or > Cancel? > > Thanks, > > Joe > >
User (Legacy) Posted March 9, 2005 Author Report Posted March 9, 2005 Frank, Thanks for the reply, but I am not fimilar with what "nRes = 1" will do. Can you explain it a little more? Thanks, Joe "Frank" <noreply@softwarefx.com> wrote in message news:UGOaYTEJFHA.1924@webserver3.softwarefx.com... > To stop the default processing of the InternalCommand (sshowing the Print > Dialog) simply assign: > > nRes = 1 > > In your Event Handler. > > As for determining whether the user pressed Ok or Canclel in the Dialog YOU > are displaying, I beleive the ShowPrinter method return a value that tells > you this. > > FP > SFX > > "Joe Glen" <jglen@quadramed.com> wrote in message > news:z48cR8BJFHA.1924@webserver3.softwarefx.com... > > In a VB exe I am trying to capture the results of the Print Dialog using > > the > > Common dialog for printers. I have two reports printing, one from Crystal > > and the other the Chart from ChartFx. What I want to do is to wait for > > the > > user to press either the Print button or the Cancel button from the common > > dialog window for printers and then either print both the report and graph > > or do nothing. What I do not understand yet, is that when the user > > presses > > the Printer icon from the toolbar, I get two dialog windows popping up, > > one > > after the other. What I have done is put code in the Internalcommand > > method > > of Chartfx1 like this: > > > > frmReport.ChartFX1.Printer.hDC = frmReport.CommonDialog1.hDC > > frmReport.CommonDialog1.ShowPrinter > > > > If wParam = 29442 Or wParam = 29443 Then > > On Error GoTo cancel > > frmReport.CommonDialog1.CancelError = True > > If lShowCriteriaPage Then > > lcrCriteriaReport.PrintOut False > > End If > > End If > > > > cancel: > > On Error GoTo 0 > > Exit Sub > > > > I guess the question is how do I shut down the Print Dialog window that > > Chartfx is producing and also control the response from the user, Print or > > Cancel? > > > > Thanks, > > > > Joe > > > > > >
User (Legacy) Posted March 9, 2005 Author Report Posted March 9, 2005 Frank, I figured out how to use the "nRes=1" code to stop the second dialog from appearing. The new code looks like this: If wParam = 29443 Then frmReport.ChartFX1.Printer.hDC = frmReport.CommonDialog1.hDC frmReport.CommonDialog1.CancelError = True On Error GoTo cancel frmReport.CommonDialog1.ShowPrinter If lShowCriteriaPage Then If frmReport.CommonDialog1.Orientation = 1 Then frmReport.ChartFX1.Printer.Orientation = 1 Else frmReport.ChartFX1.Printer.Orientation = 2 End If nPage = frmReport.CommonDialog1.Copies For i = 1 To nPage frmReport.ChartFX1.PrintIt 0, 0 Next i ' print the criteria page lcrCriteriaReport.PrintOut False nRes = 1 Else If frmReport.CommonDialog1.Orientation = 1 Then frmReport.ChartFX1.Printer.Orientation = 1 Else frmReport.ChartFX1.Printer.Orientation = 2 End If nPage = frmReport.CommonDialog1.Copies For i = 1 To nPage frmReport.ChartFX1.PrintIt 0, 0 Next i nRes = 1 End If frmReport.ChartFX1.Printer.hDC = 0 ' Restore Else If wParam = 29442 Then If lShowCriteriaPage Then lcrCriteriaReport.PrintOut False End If End If End If I am able to account for changes to the orientation and the number of copies and if the user changes printers, it automatically goes to the new printer. Are there other settings I need to account for that you know of? Thanks, Joe "Joe Glen" <jglen@quadramed.com> wrote in message news:VT3DcQLJFHA.1924@webserver3.softwarefx.com... > Frank, > > Thanks for the reply, but I am not fimilar with what "nRes = 1" will do. > Can you explain it a little more? > > Thanks, > > Joe > > "Frank" <noreply@softwarefx.com> wrote in message > news:UGOaYTEJFHA.1924@webserver3.softwarefx.com... > > To stop the default processing of the InternalCommand (sshowing the Print > > Dialog) simply assign: > > > > nRes = 1 > > > > In your Event Handler. > > > > As for determining whether the user pressed Ok or Canclel in the Dialog > YOU > > are displaying, I beleive the ShowPrinter method return a value that tells > > you this. > > > > FP > > SFX > > > > "Joe Glen" <jglen@quadramed.com> wrote in message > > news:z48cR8BJFHA.1924@webserver3.softwarefx.com... > > > In a VB exe I am trying to capture the results of the Print Dialog using > > > the > > > Common dialog for printers. I have two reports printing, one from > Crystal > > > and the other the Chart from ChartFx. What I want to do is to wait for > > > the > > > user to press either the Print button or the Cancel button from the > common > > > dialog window for printers and then either print both the report and > graph > > > or do nothing. What I do not understand yet, is that when the user > > > presses > > > the Printer icon from the toolbar, I get two dialog windows popping up, > > > one > > > after the other. What I have done is put code in the Internalcommand > > > method > > > of Chartfx1 like this: > > > > > > frmReport.ChartFX1.Printer.hDC = frmReport.CommonDialog1.hDC > > > frmReport.CommonDialog1.ShowPrinter > > > > > > If wParam = 29442 Or wParam = 29443 Then > > > On Error GoTo cancel > > > frmReport.CommonDialog1.CancelError = True > > > If lShowCriteriaPage Then > > > lcrCriteriaReport.PrintOut False > > > End If > > > End If > > > > > > cancel: > > > On Error GoTo 0 > > > Exit Sub > > > > > > I guess the question is how do I shut down the Print Dialog window that > > > Chartfx is producing and also control the response from the user, Print > or > > > Cancel? > > > > > > Thanks, > > > > > > Joe > > > > > > > > > > > >
Recommended Posts
Archived
This topic is now archived and is closed to further replies.