메뉴 건너뛰기

AcroSoft

델파이 강좌 및 팁


type

TPointArray = array[0..8191] of TPoint;
PPointArray = ^TPointArray;

...

procedure ListPapers;
var
i: integer;
Buffer: array[0..65535] of byte;
PrinterName: PChar;
PaperCount: integer;
PaperSizeArray: PPointArray;
PaperNames: array of string;
PaperSizes: array of TPoint;
Papers: array of SHORT;
begin
with Printer do
begin
PrinterName := PChar(Printers[PrinterIndex]);
PaperCount := DeviceCapabilities(PrinterName, '',
DC_PAPERNAMES, @Buffer, nil);
SetLength(PaperNames, PaperCount);
SetLength(PaperSizes, PaperCount);
SetLength(Papers, PaperCount);
for i := 0 to PaperCount - 1 do
PaperNames[I] := PChar(@Buffer[I * 64]);
DeviceCapabilities(PrinterName, '',
DC_PAPERSIZE, @Buffer, nil);
PaperSizeArray := @Buffer;
for i := 0 to PaperCount - 1 do
PaperSizes[I] := PaperSizeArray^[I];
DeviceCapabilities(PrinterName, '', DC_PAPERS, @Buffer, nil);
for i := 0 to PaperCount - 1 do
Papers[I] := PWordArray(@Buffer)^[I];
end;
end;


위로