|
Post by dragonjim on Jan 7, 2014 15:36:58 GMT 1
Hi all,
I've just spent some time tracking down a few bugs with the Printer object and I thought I would share one of them (the root cause) with anyone who may run into it in the future.
In the example below, you will get an 'Access Violation' error:
OpenW 1 Ocx CommDlg cd : cd.ShowPrint : Set Printer = cd Local Int32 pw = Printer.PageWidth ' ' Other program lines ' Ocx CommDlg cd : cd.ShowPrint : Set Printer = cd Printer.StartDoc "Test" Printer.Orientation = 1 Output = Printer Printer.StartPage FontName = "courier new" FontSize = 72 Print "Hello" Printer.EndPage Printer.EndDoc Output = Win_1
However, by inserting the method 'Printer.EndDoc' as in the example below, this error goes away.
OpenW 1 Ocx CommDlg cd : cd.ShowPrint : Set Printer = cd Local Int32 pw = Printer.PageWidth Printer.EndDoc '<<< ' ' Other program lines ' Ocx CommDlg cd : cd.ShowPrint : Set Printer = cd Printer.StartDoc "Test" Printer.Orientation = 1 Output = Printer Printer.StartPage FontName = "courier new" FontSize = 72 Print "Hello" Printer.EndPage Printer.EndDoc Output = Win_1
If the PageWidth property hadn't been queried, then there is also no error.
I don't know if this is a problem with GFA or Windows itself, just thought it may be of interest.
|
|