Z
zl_angels
Unregistered / Unconfirmed
GUEST, unregistred user!
请教各位大虾,我想实现在95/NT下把已打印到文件的文件打印出来,如dos下的
'copy ok.plt lpt1',以下是我在uddf中找到的,但是只是打印了'a test string',我用了文件流和Tmemorystream的方式,但打出来的是乱码,哪位大虾
知道,我要原程序!
请给我发E-mail,zhoulin@990.net.
Thanks!
unit Esc1;
interface
uses
SysUtils, WinTypes, WinProcs, Messages, Classes, Graphics, Controls,
Forms, Dialogs, StdCtrls;
type
TForm1 = class(TForm)
Button1: TButton;
procedure Button1Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
Form1: TForm1;
implementation
{ add the printers unit }
uses
Printers;
{$R *.DFM}
{ declare the "PASSTHROUGH" structure }
type TPrnBuffRec = record
BuffLength : word;
Buffer : array [0..255] of char;
end;
procedure TForm1.Button1Click(Sender: TObject);
var
Buff : TPrnBuffRec;
TestInt : integer;
s : string;
begin
{ Test to see if the "PASSTHROUGH" escape is supported }
TestInt := PASSTHROUGH;
if Escape(Printer.Handle,
QUERYESCSUPPORT,
sizeof(TestInt),
@TestInt,
nil) > 0 then
begin
{ Start the printout }
Printer.begin
Doc;
{ Make a string to passthrough }
s := ' A Test String ';
{ Copy the string to the buffer }
StrPCopy(Buff.Buffer, s);
{ Set the buffer length }
Buff.BuffLength := StrLen(Buff.Buffer);
{ Make the escape}
Escape(Printer.Canvas.Handle,
PASSTHROUGH,
0,
@Buff,
nil);
{ End the printout }
Printer.EndDoc;
end;
end;
end.
'copy ok.plt lpt1',以下是我在uddf中找到的,但是只是打印了'a test string',我用了文件流和Tmemorystream的方式,但打出来的是乱码,哪位大虾
知道,我要原程序!
请给我发E-mail,zhoulin@990.net.
Thanks!
unit Esc1;
interface
uses
SysUtils, WinTypes, WinProcs, Messages, Classes, Graphics, Controls,
Forms, Dialogs, StdCtrls;
type
TForm1 = class(TForm)
Button1: TButton;
procedure Button1Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
Form1: TForm1;
implementation
{ add the printers unit }
uses
Printers;
{$R *.DFM}
{ declare the "PASSTHROUGH" structure }
type TPrnBuffRec = record
BuffLength : word;
Buffer : array [0..255] of char;
end;
procedure TForm1.Button1Click(Sender: TObject);
var
Buff : TPrnBuffRec;
TestInt : integer;
s : string;
begin
{ Test to see if the "PASSTHROUGH" escape is supported }
TestInt := PASSTHROUGH;
if Escape(Printer.Handle,
QUERYESCSUPPORT,
sizeof(TestInt),
@TestInt,
nil) > 0 then
begin
{ Start the printout }
Printer.begin
Doc;
{ Make a string to passthrough }
s := ' A Test String ';
{ Copy the string to the buffer }
StrPCopy(Buff.Buffer, s);
{ Set the buffer length }
Buff.BuffLength := StrLen(Buff.Buffer);
{ Make the escape}
Escape(Printer.Canvas.Handle,
PASSTHROUGH,
0,
@Buff,
nil);
{ End the printout }
Printer.EndDoc;
end;
end;
end.