J
Jenkin_lj
Unregistered / Unconfirmed
GUEST, unregistred user!
以下是代码:
function TPrinter.GetDefaultPrinter: String;
var
p: array [0..100] of TPrinterInfo2;
i, pcbNeeded, pcReturned: Integer;
begin
try
begin
pcbNeeded := 0;
if not EnumPrinters(PRINTER_ENUM_LOCAL, nil, 2, @p, 8000, pcbNeeded, pcReturned) then
raise Exception.Create('');
for i:= 0 to pcReturned-1do
if p.Attributes and PRINTER_ATTRIBUTE_DEFAULT
= PRINTER_ATTRIBUTE_DEFAULT then
begin
Result := p.pPrinterName;
Exit;
end;
end;
except
Result := 'UnKnown';
Exit;
end;
Result := 'UnKnown';
end;
错误信息:
Types of actual and formal var parameters must be identical
光标停在pcbNeeded,后面
谢谢观看
function TPrinter.GetDefaultPrinter: String;
var
p: array [0..100] of TPrinterInfo2;
i, pcbNeeded, pcReturned: Integer;
begin
try
begin
pcbNeeded := 0;
if not EnumPrinters(PRINTER_ENUM_LOCAL, nil, 2, @p, 8000, pcbNeeded, pcReturned) then
raise Exception.Create('');
for i:= 0 to pcReturned-1do
if p.Attributes and PRINTER_ATTRIBUTE_DEFAULT
= PRINTER_ATTRIBUTE_DEFAULT then
begin
Result := p.pPrinterName;
Exit;
end;
end;
except
Result := 'UnKnown';
Exit;
end;
Result := 'UnKnown';
end;
错误信息:
Types of actual and formal var parameters must be identical
光标停在pcbNeeded,后面
谢谢观看