W
wujinhao
Unregistered / Unconfirmed
GUEST, unregistred user!
unit Unit1;
{$WARN SYMBOL_PLATFORM OFF}
interface
uses
ComObj, ActiveX, iprttest3_TLB, StdVcl,Printers,Windows;
type
Tprint = class(TAutoObject, Iprint)
protected
procedure printtext; safecall;
end;
implementation
uses ComServ;
procedure Tprint.printtext;
var
Device: array[0..255] of char;
Driver: array[0..255] of char;
Port: array[0..255] of char;
hDMode: THandle;
PDMode: PDEVMODE;
begin
//设置打印机
Printer.PrinterIndex := Printer.PrinterIndex;
Printer.GetPrinter(Device, Driver, Port, hDMode);
if hDMode <> 0 then
begin
pDMode := GlobalLock(hDMode);
if pDMode <> nil then
begin
//设定纸张类型
pDMode^.dmFields := pDMode^.dmFields or
DM_PAPERSIZE ;
pDMode^.dmPaperSize := DMPAPER_A4;
GlobalUnlock(hDMode);
end;
end ;
Printer.PrinterIndex := Printer.PrinterIndex;
Printer.BeginDoc;
Printer.Canvas.TextOut(100,100,'sssssssssss');
Printer.EndDoc;
end;
initialization
TAutoObjectFactory.Create(ComServer, Tprint, Class_print,
ciMultiInstance, tmApartment);
end.
asp代码
<% @Language = "VBScript" %>
<html>
<%
sub testprtobject
dim prtobject
set prtobject=createobject("iprttest3.print")
prtobject.printtext
set prtobject=nothing
end sub
testprtobject()
%>
错误类型:
iprttest3.print (0x8000FFFF)
/print/print.asp, 第 7 行
{$WARN SYMBOL_PLATFORM OFF}
interface
uses
ComObj, ActiveX, iprttest3_TLB, StdVcl,Printers,Windows;
type
Tprint = class(TAutoObject, Iprint)
protected
procedure printtext; safecall;
end;
implementation
uses ComServ;
procedure Tprint.printtext;
var
Device: array[0..255] of char;
Driver: array[0..255] of char;
Port: array[0..255] of char;
hDMode: THandle;
PDMode: PDEVMODE;
begin
//设置打印机
Printer.PrinterIndex := Printer.PrinterIndex;
Printer.GetPrinter(Device, Driver, Port, hDMode);
if hDMode <> 0 then
begin
pDMode := GlobalLock(hDMode);
if pDMode <> nil then
begin
//设定纸张类型
pDMode^.dmFields := pDMode^.dmFields or
DM_PAPERSIZE ;
pDMode^.dmPaperSize := DMPAPER_A4;
GlobalUnlock(hDMode);
end;
end ;
Printer.PrinterIndex := Printer.PrinterIndex;
Printer.BeginDoc;
Printer.Canvas.TextOut(100,100,'sssssssssss');
Printer.EndDoc;
end;
initialization
TAutoObjectFactory.Create(ComServer, Tprint, Class_print,
ciMultiInstance, tmApartment);
end.
asp代码
<% @Language = "VBScript" %>
<html>
<%
sub testprtobject
dim prtobject
set prtobject=createobject("iprttest3.print")
prtobject.printtext
set prtobject=nothing
end sub
testprtobject()
%>
错误类型:
iprttest3.print (0x8000FFFF)
/print/print.asp, 第 7 行