Board index » delphi » run time error when compiled

run time error when compiled

I've been writing a program the requires checking the printer status( i.e on
line, out of paper) and found the solution in FAQPAS1.TXT question #15. I
used a slightly modified version of solution A2 that will return values
representing on line, off line, and out of paper. My problem is the solution
works just fine when run from the editor, but when the program is compiled,
I get a run time error of 160 and the program terminates. Since I have no
book and only the 'net for references I would like to be pointed in the
right directing to solve this problem. For what it's worth, the machine
being used is an HP Vectra 166MHz PI running DOS 6.22 and the printer
(temporarily) is a Cannon BJ200 ink jet. This printer will be replaced with
an dot matrix at a later date. I can be contacted via email at
gwwet...@earthlink.net. Thanks.
 

Re:run time error when compiled


Could you post your source (copy-and-paste, plz not attach!) and tell us
your TP version?

"George wetzel" <gwwet...@earthlink.net> schrieb im Newsbeitrag
news:s2Ay5.12486$nk3.593315@newsread03.prod.itd.earthlink.net...

Quote
> I've been writing a program the requires checking the printer status( i.e
on
> line, out of paper) and found the solution in FAQPAS1.TXT question #15. I
> used a slightly modified version of solution A2 that will return values
> representing on line, off line, and out of paper. My problem is the
solution
> works just fine when run from the editor, but when the program is
compiled,
> I get a run time error of 160 and the program terminates. Since I have no
> book and only the 'net for references I would like to be pointed in the
> right directing to solve this problem. For what it's worth, the machine
> being used is an HP Vectra 166MHz PI running DOS 6.22 and the printer
> (temporarily) is a Cannon BJ200 ink jet. This printer will be replaced
with
> an dot matrix at a later date. I can be contacted via email at
> gwwet...@earthlink.net. Thanks.

Re:run time error when compiled


I use the following function :

function Tlpt.TxRdy:boolean;
var
  p:word;
begin
  p:=port;
  asm
    mov ah,2
    mov dx,p
    int $17 {Returns AH: $90=OK ;  $18=Off Line or Paper Out  ;
$C8=printer off}
    and ah,$98
    cmp ah,$90
    Jz @sim
    xor al,al
    jmp @end
@sim:
    mov al,1
@end:
    mov [bp-1],al
  end;
end;

Quote
George wetzel wrote:

> I've been writing a program the requires checking the printer status( i.e on
> line, out of paper) and found the solution in FAQPAS1.TXT question #15. I
> used a slightly modified version of solution A2 that will return values
> representing on line, off line, and out of paper. My problem is the solution
> works just fine when run from the editor, but when the program is compiled,
> I get a run time error of 160 and the program terminates. Since I have no
> book and only the 'net for references I would like to be pointed in the
> right directing to solve this problem. For what it's worth, the machine
> being used is an HP Vectra 166MHz PI running DOS 6.22 and the printer
> (temporarily) is a Cannon BJ200 ink jet. This printer will be replaced with
> an dot matrix at a later date. I can be contacted via email at
> gwwet...@earthlink.net. Thanks.

Re:run time error when compiled


Thanks all, but found the problem. If you run across this, it turns out that
I was opening the printer file twice with the same label. DUH. I also had a
second prob in that the MSDOS regs values are different when running from
the editor and when compiled. Again, thanks.
Quote
George wetzel <gwwet...@earthlink.net> wrote in message

news:s2Ay5.12486$nk3.593315@newsread03.prod.itd.earthlink.net...
Quote
> I've been writing a program the requires checking the printer status( i.e
on
> line, out of paper) and found the solution in FAQPAS1.TXT question #15. I
> used a slightly modified version of solution A2 that will return values
> representing on line, off line, and out of paper. My problem is the
solution
> works just fine when run from the editor, but when the program is
compiled,
> I get a run time error of 160 and the program terminates. Since I have no
> book and only the 'net for references I would like to be pointed in the
> right directing to solve this problem. For what it's worth, the machine
> being used is an HP Vectra 166MHz PI running DOS 6.22 and the printer
> (temporarily) is a Cannon BJ200 ink jet. This printer will be replaced
with
> an dot matrix at a later date. I can be contacted via email at
> gwwet...@earthlink.net. Thanks.

Other Threads