just two lines code:
-----------------------------
dim p as Printer
p.begindoc
-----------------------------
got error:
Runtime error at position 1887
Access violation at address 00432A4C in module 'printerTest.exe'. Read of address 0000001D
however, with two line code:
-----------------------------
Lprint "hello world"
Lpend
-----------------------------
There's no error, the printer works successfully.
printer begindoc error
Re: printer begindoc error
Hi,
I think you forgot te tell the system what printer to use:
dim p as printer
p.Printercount Integer R The number of printers that has been installed.
p.Printerindex Integer RW The index of the printer that is used for the printjob.
p.Printers(index) String R The name of the printer with a specified index.
You can use the PrintDialog to select a printer the can be use to set the printer
I think the Lprint prints to the default printer (using the windows printspooler)
I think you forgot te tell the system what printer to use:
dim p as printer
p.Printercount Integer R The number of printers that has been installed.
p.Printerindex Integer RW The index of the printer that is used for the printjob.
p.Printers(index) String R The name of the printer with a specified index.
You can use the PrintDialog to select a printer the can be use to set the printer
I think the Lprint prints to the default printer (using the windows printspooler)
Re: printer begindoc error
amksoft:
thanks for the answer, but still got errors
------
dim p as Printer
dim i as long
'list all printers' index and name
for i=0 to p.Printercount-1
showmessage str$(i)+": "+p.printers(i)
next i
'set the printer to use
p.printerindex = 1
p.begindoc
------
got error:
Runtime error at position 1952
Access violation at address 00432A4C in module 'printerTest.exe'. Read of address 0000001D
thanks for the answer, but still got errors
------
dim p as Printer
dim i as long
'list all printers' index and name
for i=0 to p.Printercount-1
showmessage str$(i)+": "+p.printers(i)
next i
'set the printer to use
p.printerindex = 1
p.begindoc
------
got error:
Runtime error at position 1952
Access violation at address 00432A4C in module 'printerTest.exe'. Read of address 0000001D