向打印机传送指令:
procedure WriteRawStringToPrinter(PrinterName: String;
S: String);
var
Handle: THandle;
N: DWORD;
do
cInfo1: TDocInfo1;
begin
if not OpenPrinter(PChar(PrinterName), Handle, nil) then
begin
ShowMessage('error ' + IntToStr(GetLastError));
Exit;
end;
withdo
cInfodo
begin
pDocName := PChar('testdo
c');
pOutputFile := nil;
pDataType := 'RAW';
end;
StartDocPrinter(Handle, 1, ocInfo);
StartPagePrinter(Handle);
WritePrinter(Handle, PChar(S), Length(S), N);
EndPagePrinter(Handle);
EndDocPrinter(Handle);
ClosePrinter(Handle);
end;