mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-04-27 23:23:49 +02:00
removed old files
git-svn-id: trunk@6939 -
This commit is contained in:
parent
aecdb669cb
commit
d5f85c4c3d
5
.gitattributes
vendored
5
.gitattributes
vendored
@ -149,8 +149,6 @@ components/mysql/registermysql.lrs svneol=native#text/pascal
|
||||
components/mysql/registermysql.pas svneol=native#text/pascal
|
||||
components/mysql/tmysqldatabase.xpm -text svneol=native#image/x-xpixmap
|
||||
components/mysql/tmysqldataset.xpm -text svneol=native#image/x-xpixmap
|
||||
components/printers/cupsprintersdlgs.pp svneol=native#text/pascal
|
||||
components/printers/lazprinter.pp svneol=native#text/pascal
|
||||
components/printers/linux/cupsdyn.pp svneol=native#text/pascal
|
||||
components/printers/linux/cupsprinters.inc svneol=native#text/pascal
|
||||
components/printers/linux/cupsprinters_h.inc svneol=native#text/pascal
|
||||
@ -181,9 +179,6 @@ components/printers/win32/winprinters.inc svneol=native#text/pascal
|
||||
components/printers/win32/winprinters_h.inc svneol=native#text/pascal
|
||||
components/printers/win32/winutilprn.pas svneol=native#text/pascal
|
||||
components/printers/win32/winutilprnconst.inc svneol=native#text/pascal
|
||||
components/printers/winprinters.pas svneol=native#text/pascal
|
||||
components/printers/winutilprn.pas svneol=native#text/pascal
|
||||
components/printers/winutilprnconst.inc svneol=native#text/pascal
|
||||
components/rtticontrols/baseicon.png -text svneol=unset#image/png
|
||||
components/rtticontrols/examples/example1.lfm svneol=native#text/plain
|
||||
components/rtticontrols/examples/example1.lrs svneol=native#text/pascal
|
||||
|
@ -1,80 +0,0 @@
|
||||
{*****************************************************************************
|
||||
* *
|
||||
* This file is part of the Lazarus Component Library (LCL) *
|
||||
* *
|
||||
* See the file COPYING.LCL, included in this distribution, *
|
||||
* for details about the copyright. *
|
||||
* *
|
||||
* This program is distributed in the hope that it will be useful, *
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. *
|
||||
* *
|
||||
*****************************************************************************
|
||||
|
||||
Author: Olivier GUILBAUD
|
||||
|
||||
Abstract:
|
||||
Common component dialogs for setup and more printers
|
||||
|
||||
See : /usr/share/doc/cups/licence.txt for the CUPS licence
|
||||
|
||||
History
|
||||
Fev 26 2004 - Create
|
||||
Mar 09 2004 OG - Add TPrintJobsDialog component
|
||||
Mar 16 2004 OG - add LResources units
|
||||
------------------------------------------------------------------------------}
|
||||
unit CUPSPrintersDlgs;
|
||||
|
||||
{$mode objfpc}{$H+}
|
||||
|
||||
interface
|
||||
|
||||
uses
|
||||
Classes, SysUtils,dialogs,CupsPrinters,udlgPrintersJobs,LResources;
|
||||
|
||||
type
|
||||
TPrinterSetupDialog = class(TCommonDialog)
|
||||
public
|
||||
function Execute: Boolean; override;
|
||||
end;
|
||||
|
||||
TPrintJobsDialog = class(TCommonDialog)
|
||||
public
|
||||
function Execute: Boolean; override;
|
||||
end;
|
||||
|
||||
procedure Register;
|
||||
|
||||
|
||||
implementation
|
||||
|
||||
|
||||
procedure Register;
|
||||
begin
|
||||
RegisterComponents('Dialogs',[TPrinterSetupDialog,TPrintJobsDialog]);
|
||||
end;
|
||||
|
||||
{ TPrinterSetupDialog }
|
||||
|
||||
function TPrinterSetupDialog.Execute: Boolean;
|
||||
begin
|
||||
Result:=(Printer.ExecuteSetup<>srCancel);
|
||||
end;
|
||||
|
||||
{ TPrintJobsDialog }
|
||||
|
||||
function TPrintJobsDialog.Execute: Boolean;
|
||||
begin
|
||||
Result:=True;
|
||||
With TdlgPrintersJobs.Create(nil) do
|
||||
try
|
||||
ShowModal;
|
||||
finally
|
||||
Free;
|
||||
end;
|
||||
end;
|
||||
|
||||
INITIALIZATION
|
||||
{$I cupsprintersdlgs.lrs}
|
||||
end.
|
||||
|
@ -1,32 +0,0 @@
|
||||
{*****************************************************************************
|
||||
* *
|
||||
* This file is part of the Lazarus Component Library (LCL) *
|
||||
* *
|
||||
* See the file COPYING.LCL, included in this distribution, *
|
||||
* for details about the copyright. *
|
||||
* *
|
||||
* This program is distributed in the hope that it will be useful, *
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. *
|
||||
* *
|
||||
*****************************************************************************
|
||||
|
||||
Author: Olivier GUILBAUD
|
||||
|
||||
Abstract:
|
||||
This unit initialize the printer system
|
||||
|
||||
------------------------------------------------------------------------------}
|
||||
unit LazPrinter;
|
||||
|
||||
{$mode objfpc}{$H+}
|
||||
|
||||
interface
|
||||
|
||||
uses
|
||||
Classes, SysUtils;
|
||||
|
||||
implementation
|
||||
|
||||
end.
|
||||
|
1
components/printers/lib/README
Normal file
1
components/printers/lib/README
Normal file
@ -0,0 +1 @@
|
||||
output directory of the package printer4lazarus
|
@ -1,593 +0,0 @@
|
||||
{
|
||||
Author: Olivier Guilbaud
|
||||
|
||||
*****************************************************************************
|
||||
* *
|
||||
* This file is part of the Lazarus Component Library (LCL) *
|
||||
* *
|
||||
* See the file COPYING.LCL, included in this distribution, *
|
||||
* for details about the copyright. *
|
||||
* *
|
||||
* This program is distributed in the hope that it will be useful, *
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. *
|
||||
* *
|
||||
*****************************************************************************
|
||||
|
||||
Abstract:
|
||||
This unit provide an access at Printers for Win32
|
||||
|
||||
History
|
||||
04/03/2005 OG - Fix build (from Jesus)
|
||||
- Fix select printer dialog.
|
||||
|
||||
}
|
||||
|
||||
unit WinPrinters;
|
||||
|
||||
{$mode objfpc}{$H+}
|
||||
|
||||
interface
|
||||
|
||||
uses
|
||||
Classes, SysUtils,Printers,LCLType,Forms,Windows,dialogs;
|
||||
|
||||
Type
|
||||
TWinPrinter = class(TPrinter)
|
||||
private
|
||||
fLastHandleType : Byte; //0=None 1=IC 2=DC
|
||||
fDC : HDC;
|
||||
fPrinterHandle : THandle;
|
||||
|
||||
procedure SetIC;
|
||||
procedure SetDC;
|
||||
procedure ClearDC;
|
||||
protected
|
||||
procedure DoBeginDoc; override;
|
||||
procedure DoNewPage; override;
|
||||
procedure DoEndDoc(aAborded : Boolean); override;
|
||||
procedure DoAbort; override;
|
||||
|
||||
procedure DoEnumPrinters(Lst : TStrings); override;
|
||||
procedure DoResetPrintersList; override;
|
||||
|
||||
procedure DoEnumPapers(Lst : TStrings); override;
|
||||
function DoGetDefaultPaperName: string; override;
|
||||
procedure DoSetPaperName(aName : string); override;
|
||||
function DoGetPaperRect(aName : string; Var aPaperRc : TPaperRect) : Integer; override;
|
||||
|
||||
function DoSetPrinter(aName : string): Integer; override;
|
||||
|
||||
function DoGetCopies : Integer; override;
|
||||
procedure DoSetCopies(aValue : Integer); override;
|
||||
function DoGetOrientation: TPrinterOrientation; override;
|
||||
procedure DoSetOrientation(aValue : TPrinterOrientation); override;
|
||||
public
|
||||
constructor Create; override;
|
||||
destructor Destroy; override;
|
||||
|
||||
function ExecuteProperties : Boolean; override;
|
||||
function ExecuteSetup : Boolean; override;
|
||||
end;
|
||||
|
||||
implementation
|
||||
Uses WinUtilPrn;
|
||||
|
||||
Const
|
||||
Win32Orientations: array [TPrinterOrientation] of Integer = (
|
||||
DMORIENT_PORTRAIT, DMORIENT_LANDSCAPE, DMORIENT_PORTRAIT, DMORIENT_LANDSCAPE);
|
||||
|
||||
Type
|
||||
TPrinterDevice = class
|
||||
Name : String;
|
||||
Driver : String;
|
||||
Device : String;
|
||||
Port : String;
|
||||
|
||||
DefaultPaper : Short;
|
||||
|
||||
DevMode: TDeviceMode;
|
||||
end;
|
||||
|
||||
{ TWinPrinter }
|
||||
|
||||
constructor TWinPrinter.Create;
|
||||
begin
|
||||
inherited Create;
|
||||
|
||||
fLastHandleType:=0; //None
|
||||
fPrinterHandle :=0; //None
|
||||
end;
|
||||
|
||||
destructor TWinPrinter.Destroy;
|
||||
begin
|
||||
ClearDC;
|
||||
DoResetPrintersList;
|
||||
|
||||
if fPrinterHandle<>0 then
|
||||
ClosePrinter(fPrinterHandle);
|
||||
|
||||
inherited Destroy;
|
||||
end;
|
||||
|
||||
function TWinPrinter.ExecuteProperties: Boolean;
|
||||
Var NewDevMode : TDeviceMode;
|
||||
PDev : TPrinterDevice;
|
||||
begin
|
||||
if Printers.Count>0 then
|
||||
begin
|
||||
if fPrinterHandle=0 then
|
||||
SetPrinter(Printers.Strings[PrinterIndex]);
|
||||
|
||||
if fPrinterHandle=0 then
|
||||
raise EPrinter.Create('Printer handle not defined');
|
||||
|
||||
PDev:=TPrinterDevice(Printers.Objects[PrinterIndex]);
|
||||
FillChar(NewDevMode,SizeOf(NewDevMode),0);
|
||||
|
||||
Result:=(AdvancedDocumentProperties(0,fPrinterHandle,PChar(PDev.Name),@PDev.DevMode,@NewDevMode)<>0);
|
||||
|
||||
if Result then
|
||||
PDev.DevMode:=NewDevMode;
|
||||
end;
|
||||
end;
|
||||
|
||||
function TWinPrinter.ExecuteSetup: Boolean;
|
||||
var lpp : tagPD;
|
||||
PDev : TPrinterDevice;
|
||||
DevMode : PDeviceMode;
|
||||
DeviceMode : THandle;
|
||||
|
||||
DevNames : PDevNames;
|
||||
St : PChar;
|
||||
begin
|
||||
if Printers.Count>0 then
|
||||
begin
|
||||
FillChar(lpp,SizeOf(lpp),0);
|
||||
|
||||
with lpp do
|
||||
begin
|
||||
lStructSize:=SizeOf(lpp);
|
||||
hInstance:=LCLType.HInstance;
|
||||
Flags:=PD_COLLATE or PD_USEDEVMODECOPIES; //PD_PRINTSETUP ;
|
||||
hWndOwner:=Application.Handle;
|
||||
|
||||
PDev:=TPrinterDevice(Printers.Objects[PrinterIndex]);
|
||||
|
||||
DeviceMode:=GlobalAlloc(GHND,SizeOf(PDev.DevMode)+1);
|
||||
DevMode:=PDeviceMode(GlobalLock(DeviceMode));
|
||||
try
|
||||
DevMode^:=PDev.DevMode;
|
||||
finally
|
||||
GlobalUnLock(DeviceMode);
|
||||
end;
|
||||
|
||||
hDevMode:=DeviceMode;
|
||||
nCopies:=1;
|
||||
try
|
||||
if PrintDlg(lpp) then
|
||||
begin
|
||||
St:='';
|
||||
//Change Selected printer
|
||||
if lpp.hDevNames<>0 then
|
||||
begin
|
||||
DevNames:=PDevNames(GlobalLock(lpp.hDevNames));
|
||||
try
|
||||
St:=PChar(DevNames)+DevNames^.wDeviceOffset;
|
||||
SetPrinter(St);
|
||||
finally
|
||||
GlobalUnlock(lpp.hDevNames);
|
||||
GlobalFree(lpp.hDevNames);
|
||||
end;
|
||||
end;
|
||||
|
||||
if lpp.hDevMode<>0 then
|
||||
begin
|
||||
DevMode:=PDeviceMode(GlobalLock(lpp.hDevMode));
|
||||
try
|
||||
//Set the properties for the selected printer
|
||||
PDev:=TPrinterDevice(Printers.Objects[PrinterIndex]);
|
||||
PDev.DevMode:=DevMode^;
|
||||
finally
|
||||
GlobalUnlock(lpp.hDevMode);
|
||||
GlobalFree(lpp.hDevMode);
|
||||
end;
|
||||
end;
|
||||
end;
|
||||
finally
|
||||
if DeviceMode<>0 then
|
||||
GlobalFree(DeviceMode);
|
||||
|
||||
if hDevNames<>0 then
|
||||
GlobalFree(hDevNames);
|
||||
end;
|
||||
end;
|
||||
end;
|
||||
end;
|
||||
|
||||
procedure TWinPrinter.SetIC;
|
||||
var PDev : TPrinterDevice;
|
||||
begin
|
||||
if (fLastHandleType=0) and (Printers.Count>0) then
|
||||
begin
|
||||
PDev:=TPrinterDevice(Printers.Objects[PrinterIndex]);
|
||||
fDC:=CreateIC(PChar(PDev.Driver),PChar(PDev.Device),
|
||||
PChar(PDev.Port),@PDev.DevMode);
|
||||
if fDC=0 then
|
||||
raise EPrinter.Create('Invalide printer');
|
||||
if Assigned(Canvas) then
|
||||
Canvas.Handle:=fDC;
|
||||
fLastHandleType:=1;
|
||||
end;
|
||||
end;
|
||||
|
||||
procedure TWinPrinter.SetDC;
|
||||
var PDev : TPrinterDevice;
|
||||
begin
|
||||
if (fLastHandleType<>2) and (Printers.Count>0) then
|
||||
begin
|
||||
ClearDC;
|
||||
|
||||
PDev:=TPrinterDevice(Printers.Objects[PrinterIndex]);
|
||||
fDC:=CreateDC(PChar(PDev.Driver),PChar(PDev.Device),
|
||||
PChar(PDev.Port),@PDev.DevMode);
|
||||
if fDC=0 then
|
||||
raise EPrinter.Create('Invalide printer');
|
||||
if Assigned(Canvas) then
|
||||
Canvas.Handle:=fDC;
|
||||
fLastHandleType:=2;
|
||||
end;
|
||||
end;
|
||||
|
||||
procedure TWinPrinter.ClearDC;
|
||||
begin
|
||||
if Assigned(Canvas) then
|
||||
Canvas.Handle:=0;
|
||||
if fDC<>0 then
|
||||
DeleteDC(fDC);
|
||||
fLastHandleType:=0;
|
||||
end;
|
||||
|
||||
procedure TWinPrinter.DoBeginDoc;
|
||||
var Inf: TDocInfo;
|
||||
begin
|
||||
inherited DoBeginDoc;
|
||||
|
||||
if fPrinterHandle=0 then
|
||||
raise EPrinter.Create('Printer handle not defined');
|
||||
|
||||
SetDC;
|
||||
Canvas.Refresh;
|
||||
|
||||
FillChar(Inf,SizeOf(Inf),0);
|
||||
Inf.cbSize:=SizeOf(Inf);
|
||||
Inf.lpszDocName:=PChar(Title);
|
||||
|
||||
StartDoc(fDC,Inf);
|
||||
StartPage(fDC);
|
||||
end;
|
||||
|
||||
procedure TWinPrinter.DoNewPage;
|
||||
begin
|
||||
inherited DoNewPage;
|
||||
|
||||
EndPage(fDC);
|
||||
StartPage(fDC);
|
||||
Canvas.Refresh;
|
||||
end;
|
||||
|
||||
procedure TWinPrinter.DoEndDoc(aAborded: Boolean);
|
||||
begin
|
||||
inherited DoEndDoc(aAborded);
|
||||
|
||||
EndPage(fDC);
|
||||
if not aAborded then
|
||||
WinUtilPrn.EndDoc(fDC);
|
||||
end;
|
||||
|
||||
procedure TWinPrinter.DoAbort;
|
||||
begin
|
||||
inherited DoAbort;
|
||||
AbortDoc(fDC);
|
||||
end;
|
||||
|
||||
|
||||
//Enum all defined printers. First printer it's default
|
||||
procedure TWinPrinter.DoEnumPrinters(Lst: TStrings);
|
||||
Var Flags : DWORD;
|
||||
Level : DWORD;
|
||||
PrtCount : DWORD;
|
||||
Needed : DWORD;
|
||||
Buffer : PChar;
|
||||
InfoPrt : PChar;
|
||||
i : Integer;
|
||||
DefaultPrinter : array[0..79] of Char;
|
||||
LstStr : TStringList;
|
||||
PDev : TPrinterDevice;
|
||||
|
||||
begin
|
||||
Level:=5; //Compatible with all Win32 versions
|
||||
DefaultPrinter:='';
|
||||
|
||||
//Retrieve Default printer
|
||||
Flags:=PRINTER_ENUM_DEFAULT;
|
||||
//Evaluate buffer size
|
||||
Needed:=0;
|
||||
EnumPrinters(Flags,nil,Level,nil,0,Needed,PrtCount);
|
||||
if Needed<>0 then
|
||||
begin
|
||||
GetMem(Buffer,Needed);
|
||||
try
|
||||
//Get default printer
|
||||
if EnumPrinters(Flags,nil,Level,Buffer,Needed,Needed,PrtCount) then
|
||||
DefaultPrinter:=PPRINTER_INFO_5(Buffer)^.pPrinterName;
|
||||
finally
|
||||
FreeMem(Buffer);
|
||||
end;
|
||||
end
|
||||
else
|
||||
begin
|
||||
LstStr:=TStringList.Create;
|
||||
try
|
||||
GetProfileString(PChar('windows'),PChar('device'),PChar(''),DefaultPrinter,SizeOf(DefaultPrinter));
|
||||
LstStr.CommaText:=DefaultPrinter;
|
||||
if LstStr.Count>0 then
|
||||
DefaultPrinter:=LstStr.Strings[0];
|
||||
finally
|
||||
LstStr.Free;
|
||||
end;
|
||||
end;
|
||||
|
||||
Flags:=PRINTER_ENUM_CONNECTIONS or PRINTER_ENUM_LOCAL;
|
||||
Level:=2;
|
||||
|
||||
//Evaluate buffer size
|
||||
Needed:=0;
|
||||
EnumPrinters(Flags,nil,Level,nil,0,Needed,PrtCount);
|
||||
if Needed<>0 then
|
||||
begin
|
||||
GetMem(Buffer,Needed);
|
||||
try
|
||||
//Enumerate Printers
|
||||
if EnumPrinters(Flags,nil,Level,Buffer,Needed,Needed,PrtCount) then
|
||||
begin
|
||||
InfoPrt:=Buffer;
|
||||
for i:=0 to PrtCount-1 do
|
||||
begin
|
||||
if Level=2 then
|
||||
begin
|
||||
PDev:=TPrinterDevice.Create;
|
||||
PDev.Name :=PPRINTER_INFO_2(InfoPrt)^.pPrinterName;
|
||||
PDev.Device :=PPRINTER_INFO_2(InfoPrt)^.PDevMode^.dmDeviceName;
|
||||
PDev.Driver :=PPRINTER_INFO_2(InfoPrt)^.pDriverName;
|
||||
PDev.Port :=PPRINTER_INFO_2(InfoPrt)^.pPortName;
|
||||
PDev.DevMode:=PPRINTER_INFO_2(InfoPrt)^.PDevMode^;
|
||||
PDev.DefaultPaper:=PPRINTER_INFO_2(InfoPrt)^.PDevMode^.dmPaperSize;
|
||||
|
||||
if AnsiCompareText(PDev.Name,DefaultPrinter)<>0 then
|
||||
Lst.AddObject(PDev.Name,PDev)
|
||||
else
|
||||
begin
|
||||
Lst.Insert(0,PDev.Name);
|
||||
Lst.Objects[0]:=PDev;
|
||||
end;
|
||||
Inc(InfoPrt,SizeOf(_PRINTER_INFO_2));
|
||||
end;
|
||||
end;
|
||||
end;
|
||||
finally
|
||||
FreeMem(Buffer);
|
||||
end;
|
||||
end;
|
||||
end;
|
||||
|
||||
procedure TWinPrinter.DoResetPrintersList;
|
||||
var i : Integer;
|
||||
Obj : TObject;
|
||||
begin
|
||||
inherited DoResetPrintersList;
|
||||
|
||||
if Printers.Count>0 then
|
||||
begin
|
||||
for i:=0 to Printers.Count-1 do
|
||||
begin
|
||||
Obj:=Printers.Objects[i];
|
||||
Printers.Objects[i]:=nil;
|
||||
FreeAndNil(Obj);
|
||||
end;
|
||||
end;
|
||||
end;
|
||||
|
||||
procedure TWinPrinter.DoEnumPapers(Lst: TStrings);
|
||||
var Buffer : PChar;
|
||||
PaperN : String;
|
||||
PaperC,i : Integer;
|
||||
PDev : TPrinterDevice;
|
||||
ArPapers : Array[0..255] of Word;
|
||||
begin
|
||||
inherited DoEnumPapers(Lst);
|
||||
|
||||
if (Printers.Count>0) then
|
||||
begin
|
||||
PDev:=TPrinterDevice(Printers.Objects[PrinterIndex]);
|
||||
|
||||
if fPrinterHandle=0 then
|
||||
SetPrinter(Printers.Strings[PrinterIndex]);
|
||||
|
||||
if fPrinterHandle=0 then
|
||||
raise EPrinter.Create('Printer handle not defined');
|
||||
|
||||
//Reteive the supported papers
|
||||
PaperC:=0;
|
||||
GetMem(Buffer,64*255);
|
||||
try
|
||||
PaperC:=DeviceCapabilities(PChar(Pdev.Name),PCHar(PDev.Port),
|
||||
DC_PAPERNAMES,Buffer,@PDev.DevMode);
|
||||
for i:=0 to PaperC-1 do
|
||||
begin
|
||||
PaperN:=StrPas(Buffer+i*64);
|
||||
Lst.Add(PaperN);
|
||||
end;
|
||||
finally
|
||||
FreeMem(Buffer);
|
||||
end;
|
||||
|
||||
//Retreive the code of papers
|
||||
FillChar(ArPapers,SizeOf(ArPapers),0);
|
||||
PaperC:=DeviceCapabilities(PChar(Pdev.Name),PCHar(PDev.Port),
|
||||
DC_PAPERS,@ArPapers,@PDev.DevMode);
|
||||
for i:=0 to PaperC-1 do
|
||||
Lst.Objects[i]:=TObject(Pointer(Integer(ArPapers[i])));
|
||||
end;
|
||||
|
||||
end;
|
||||
|
||||
function TWinPrinter.DoGetDefaultPaperName: string;
|
||||
var i : Integer;
|
||||
PDev : TPrinterDevice;
|
||||
begin
|
||||
Result:=inherited DoGetDefaultPaperName;
|
||||
|
||||
if (Printers.Count>0) then
|
||||
begin
|
||||
PDev:=TPrinterDevice(Printers.Objects[PrinterIndex]);
|
||||
|
||||
i:=PaperSize.SupportedPapers.IndexOfObject(TObject(Pointer(Integer(PDev.DefaultPaper))));
|
||||
if i<>-1 then
|
||||
Result:=PaperSize.SupportedPapers.Strings[i];
|
||||
end;
|
||||
end;
|
||||
|
||||
procedure TWinPrinter.DoSetPaperName(aName: string);
|
||||
var i : Integer;
|
||||
PDev : TPrinterDevice;
|
||||
j : SHORT;
|
||||
begin
|
||||
inherited DoSetPaperName(aName);
|
||||
|
||||
if (Printers.Count>0) then
|
||||
begin
|
||||
ClearDC;
|
||||
|
||||
PDev:=TPrinterDevice(Printers.Objects[PrinterIndex]);
|
||||
|
||||
i:=PaperSize.SupportedPapers.IndexOf(aName);
|
||||
if i<>-1 then
|
||||
begin
|
||||
j:=SHORT(Pointer(PaperSize.SupportedPapers.Objects[i]));
|
||||
PDev.DevMode.dmPaperSize:=j;
|
||||
end;
|
||||
end;
|
||||
end;
|
||||
|
||||
function TWinPrinter.DoGetPaperRect(aName: string; var aPaperRc: TPaperRect): Integer;
|
||||
var NSize, i : Integer;
|
||||
PDev : TPrinterDevice;
|
||||
ArSizes : Array[0..255] of TPoint;
|
||||
begin
|
||||
Result:=Inherited DoGetPaperRect(aName,aPaperRc);
|
||||
|
||||
if (Printers.Count>0) then
|
||||
begin
|
||||
PDev:=TPrinterDevice(Printers.Objects[PrinterIndex]);
|
||||
|
||||
//Retreive the Width and Height of aName paper
|
||||
FillChar(ArSizes,SizeOf(ArSizes),0);
|
||||
NSize:=DeviceCapabilities(PChar(Pdev.Name),PChar(PDev.Port),
|
||||
DC_PAPERSIZE,@ArSizes,@PDev.DevMode);
|
||||
i:=PaperSize.SupportedPapers.IndexOf(aName);
|
||||
if (i>=0) and (i<NSize) and (NSize<>0) then
|
||||
begin
|
||||
aPaperRc.PhysicalRect:=Classes.Rect(0,0,ArSizes[i].X,ArSizes[i].Y);
|
||||
aPaperRc.WorkRect:=Classes.Rect(0,0,ArSizes[i].X,ArSizes[i].Y);
|
||||
|
||||
Result:=1;
|
||||
end;
|
||||
end;
|
||||
|
||||
end;
|
||||
|
||||
function TWinPrinter.DoSetPrinter(aName: string): Integer;
|
||||
var i : Integer;
|
||||
PDev : TPrinterDevice;
|
||||
begin
|
||||
Result:=inherited DoSetPrinter(aName);
|
||||
|
||||
i:=Printers.IndexOf(aName);
|
||||
if i<>-1 then
|
||||
begin
|
||||
ClearDC;
|
||||
|
||||
PDev:=TPrinterDevice(Printers.Objects[PrinterIndex]);
|
||||
if fPrinterHandle<>0 then
|
||||
ClosePrinter(fPrinterHandle);
|
||||
|
||||
if OpenPrinter(PChar(PDev.Name),fPrinterHandle,nil) then
|
||||
Result:=i;
|
||||
end;
|
||||
end;
|
||||
|
||||
function TWinPrinter.DoGetCopies: Integer;
|
||||
var PDev : TPrinterDevice;
|
||||
begin
|
||||
Result:=inherited DoGetCopies;
|
||||
|
||||
if (Printers.Count>0) then
|
||||
begin
|
||||
PDev:=TPrinterDevice(Printers.Objects[PrinterIndex]);
|
||||
|
||||
if PDev.DevMode.dmCopies<>0 then
|
||||
Result:=PDev.DevMode.dmCopies;
|
||||
end;
|
||||
end;
|
||||
|
||||
procedure TWinPrinter.DoSetCopies(aValue: Integer);
|
||||
var PDev : TPrinterDevice;
|
||||
begin
|
||||
inherited DoSetCopies(aValue);
|
||||
|
||||
if (Printers.Count>0) and (aValue>0) then
|
||||
begin
|
||||
PDev:=TPrinterDevice(Printers.Objects[PrinterIndex]);
|
||||
|
||||
ClearDC;
|
||||
PDev.DevMode.dmCopies:=aValue;
|
||||
end;
|
||||
end;
|
||||
|
||||
function TWinPrinter.DoGetOrientation: TPrinterOrientation;
|
||||
var PDev : TPrinterDevice;
|
||||
begin
|
||||
Result:=inherited DoGetOrientation;
|
||||
|
||||
if (Printers.Count>0) then
|
||||
begin
|
||||
PDev:=TPrinterDevice(Printers.Objects[PrinterIndex]);
|
||||
|
||||
Case PDev.DevMode.dmOrientation of
|
||||
DMORIENT_PORTRAIT : Result:=poPortrait;
|
||||
DMORIENT_LANDSCAPE : Result:=poLandscape;
|
||||
end;
|
||||
end;
|
||||
end;
|
||||
|
||||
procedure TWinPrinter.DoSetOrientation(aValue: TPrinterOrientation);
|
||||
var PDev : TPrinterDevice;
|
||||
begin
|
||||
inherited DoSetOrientation(aValue);
|
||||
|
||||
if (Printers.Count>0) then
|
||||
begin
|
||||
PDev:=TPrinterDevice(Printers.Objects[PrinterIndex]);
|
||||
|
||||
ClearDC;
|
||||
PDev.DevMode.dmOrientation:=Win32Orientations[aValue];
|
||||
end;
|
||||
end;
|
||||
|
||||
|
||||
INITIALIZATION
|
||||
Printer:=TWinPrinter.Create;
|
||||
|
||||
end.
|
||||
|
@ -1,252 +0,0 @@
|
||||
{
|
||||
Author: Olivier Guilbaud
|
||||
|
||||
*****************************************************************************
|
||||
* *
|
||||
* This file is part of the Lazarus Component Library (LCL) *
|
||||
* *
|
||||
* See the file COPYING.LCL, included in this distribution, *
|
||||
* for details about the copyright. *
|
||||
* *
|
||||
* This program is distributed in the hope that it will be useful, *
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. *
|
||||
* *
|
||||
*****************************************************************************
|
||||
|
||||
Abstract:
|
||||
This unit provide an access at Printers spool and other functions for manage
|
||||
the printers on Win32
|
||||
|
||||
Documentations
|
||||
- Wine project
|
||||
- Microsoft MSDN Web
|
||||
}
|
||||
|
||||
unit WinUtilPrn;
|
||||
|
||||
{$mode objfpc}{$H+}
|
||||
|
||||
interface
|
||||
|
||||
{$IFNDEF WIN32}
|
||||
//This unit it's reserved to Win32
|
||||
{$ENDIF}
|
||||
|
||||
uses
|
||||
Classes, SysUtils,LCLType;
|
||||
|
||||
const
|
||||
{$i winutilprnconst.inc}
|
||||
|
||||
LibWinSpool = 'winspool.drv';
|
||||
|
||||
type
|
||||
PDevNames = ^tagDEVNAMES;
|
||||
tagDEVNAMES = record
|
||||
wDriverOffset: Word;
|
||||
wDeviceOffset: Word;
|
||||
wOutputOffset: Word;
|
||||
wDefault: Word;
|
||||
end;
|
||||
|
||||
TFcntHook = function(Wnd: HWND; uiMsg: UINT; wParam: WPARAM; lParam: LPARAM): UINT stdcall;
|
||||
|
||||
tagPD=packed Record
|
||||
lStructSize : DWORD;
|
||||
hWndOwner : HWND;
|
||||
hDevMode : HGLOBAL;
|
||||
hDevNames : HGLOBAL;
|
||||
hDC : HDC;
|
||||
Flags : DWORD;
|
||||
nFromPage : Word;
|
||||
nToPage : Word;
|
||||
nMinPage : Word;
|
||||
nMaxPage : Word;
|
||||
nCopies : Word;
|
||||
hInstance : HINST;
|
||||
lCustData : LPARAM;
|
||||
lpfnPrintHook: TFcntHook;
|
||||
lpfnSetupHook: TFcntHook;
|
||||
lpPrintTemplateName: PChar;
|
||||
lpSetupTemplateName: PChar;
|
||||
hPrintTemplate : HGLOBAL;
|
||||
hSetupTemplate : HGLOBAL;
|
||||
end;
|
||||
|
||||
PDeviceMode = ^TDeviceMode;
|
||||
TDeviceMode = packed Record
|
||||
dmDeviceName : array[0..31] of AnsiChar;
|
||||
dmSpecVersion : Word;
|
||||
dmDriverVersion : Word;
|
||||
dmSize : Word;
|
||||
dmDriverExtra : Word;
|
||||
dmFields : DWORD;
|
||||
dmOrientation : SHORT;
|
||||
dmPaperSize : SHORT;
|
||||
dmPaperLength : SHORT;
|
||||
dmPaperWidth : SHORT;
|
||||
dmScale : SHORT;
|
||||
dmCopies : SHORT;
|
||||
dmDefaultSource : SHORT;
|
||||
dmPrintQuality : SHORT;
|
||||
dmColor : SHORT;
|
||||
dmDuplex : SHORT;
|
||||
dmYResolution : SHORT;
|
||||
dmTTOption : SHORT;
|
||||
dmCollate : SHORT;
|
||||
dmFormName : Array[0..31] of AnsiChar;
|
||||
dmLogPixels : Word;
|
||||
dmBitsPerPel : DWORD;
|
||||
dmPelsWidth : DWORD;
|
||||
dmPelsHeight : DWORD;
|
||||
dmDisplayFlags : DWORD;
|
||||
dmDisplayFrequency: DWORD;
|
||||
dmICMMethod : DWORD;
|
||||
dmICMIntent : DWORD;
|
||||
dmMediaType : DWORD;
|
||||
dmDitherType : DWORD;
|
||||
dmICCManufacturer : DWORD;
|
||||
dmICCModel : DWORD;
|
||||
dmPanningWidth : DWORD;
|
||||
dmPanningHeight : DWORD;
|
||||
end;
|
||||
|
||||
PPrinterDefaults = ^_PRINTER_DEFAULTS;
|
||||
_PRINTER_DEFAULTS = record
|
||||
pDatatype : PChar;
|
||||
pDevMode : PDeviceMode;
|
||||
DesiredAccess: DWord;
|
||||
end;
|
||||
|
||||
//Size and ImageableArea Specifies the width and height,
|
||||
//in thousandths of millimeters, of the form
|
||||
PFORM_INFO_1 =^_FORM_INFO_1;
|
||||
_FORM_INFO_1 = Record
|
||||
Flags : DWORD;
|
||||
pName : PChar;
|
||||
Size : TSize;
|
||||
ImageableArea: TRect;
|
||||
end;
|
||||
|
||||
TDocInfo = record
|
||||
cbSize : Integer;
|
||||
lpszDocName : PChar;
|
||||
lpszOutput : PChar;
|
||||
lpszDatatype: PChar;
|
||||
fwType : DWORD;
|
||||
end;
|
||||
|
||||
PPRINTER_INFO_1 = ^_PRINTER_INFO_1;
|
||||
_PRINTER_INFO_1 = Record
|
||||
Flags : DWORD;
|
||||
pDescription : PChar;
|
||||
pName : PChar;
|
||||
pComment : PChar;
|
||||
end;
|
||||
|
||||
PPRINTER_INFO_2 = ^_PRINTER_INFO_2;
|
||||
_PRINTER_INFO_2 = Record
|
||||
pServerName : PChar;
|
||||
pPrinterName : PChar;
|
||||
pShareName : PChar;
|
||||
pPortName : PChar;
|
||||
pDriverName : PChar;
|
||||
pComment : PChar;
|
||||
pLocation : PChar;
|
||||
pDevMode : PDeviceMode;
|
||||
pSepFile : PChar;
|
||||
pPrintProcessor : PChar;
|
||||
pDatatype : PChar;
|
||||
pParameters : PChar;
|
||||
pSecurityDescriptor : Pointer;
|
||||
Attributes : DWORD;
|
||||
Priority : DWORD;
|
||||
DefaultPriority : DWORD;
|
||||
StartTime : DWORD;
|
||||
UntilTime : DWORD;
|
||||
Status : DWORD;
|
||||
cJobs : DWORD;
|
||||
AveragePPM : DWORD;
|
||||
end;
|
||||
|
||||
PPRINTER_INFO_4 = ^_PRINTER_INFO_4;
|
||||
_PRINTER_INFO_4 = Record
|
||||
pPrinterName : PChar;
|
||||
pServerName : PChar;
|
||||
Attributes : DWORD;
|
||||
end;
|
||||
|
||||
PPRINTER_INFO_5 = ^_PRINTER_INFO_5;
|
||||
_PRINTER_INFO_5 = Record
|
||||
pPrinterName : PChar;
|
||||
pPortName : PChar;
|
||||
Attributes : DWORD;
|
||||
DeviceNotSelectedTimeout : DWORD;
|
||||
TransmissionRetryTimeout : DWORD;
|
||||
end;
|
||||
|
||||
|
||||
function OpenPrinter(pPrinterName : PChar; // printer or server name
|
||||
var phPrinter : THandle; // printer or server handle
|
||||
pDefaults : PPrinterDefaults // printer defaults
|
||||
) : BOOL; stdCall; external LibWinSpool name 'OpenPrinterA';
|
||||
|
||||
function ClosePrinter(hPrinter : THandle //handle to printer object
|
||||
) : BOOL; stdCall; external LibWinSpool name 'ClosePrinter';
|
||||
|
||||
function EnumPrinters(Flags: DWORD; //Printer objet type
|
||||
Name : PChar; //Name of printer object
|
||||
Level: DWORD; //Information level
|
||||
pPrinterEnum: Pointer; //Printer information buffer
|
||||
cbBuf: DWORD; //Size of printer information buffer
|
||||
var pcbNeeded, //Bytes recieved or required
|
||||
pcReturned: DWORD //Number of printers enumerated
|
||||
): BOOL; stdcall; external LibWinSpool name 'EnumPrintersA';
|
||||
{Unsuported on W95/98/Me :o(
|
||||
Function EnumForms(
|
||||
hPrinter : THandle; // handle to printer object
|
||||
Level : DWORD; // data level
|
||||
pForm : Pointer; // form information buffer
|
||||
cbBuf : DWord; // size of form information buffer
|
||||
var pcbNeeded : DWORD; // bytes received or required
|
||||
var pcReturned: DWORD // number of forms received
|
||||
|
||||
): BOOL; stdcall; external LibWinSpool name 'EnumFormsA';}
|
||||
|
||||
{Function not compatible with all versions of Windows
|
||||
function GetDefaultPrinter(
|
||||
pszBuffer : PChar; // printer name buffer
|
||||
var pcchBuffer : DWord // size of name buffer
|
||||
) : BOOL stdcall; external LibWinSpool name 'GetDefaultPrinterA';
|
||||
}
|
||||
|
||||
function AdvancedDocumentProperties(
|
||||
hWnd : HWND; // handle to parent window
|
||||
hPrinter : THandle; // handle to printer object
|
||||
pDeviceName : PChar; // driver name
|
||||
pDevModeOutput : PDeviceMode; // modified device mode data
|
||||
pDevModeInput : PDeviceMode // original device mode data
|
||||
): Longint; stdcall; external LibWinSpool name 'AdvancedDocumentPropertiesA';
|
||||
|
||||
function DeviceCapabilities(pDevice, pPort: PChar; fwCapability: Word; pOutput: PChar;
|
||||
DevMode: PDeviceMode): Integer; stdcall; external LibWinSpool name 'DeviceCapabilitiesA';
|
||||
|
||||
function GetProfileString(lpAppName:PChar; lpKeyName:PChar; lpDefault:PChar; lpReturnedString:PChar; nSize:DWORD):DWORD; stdcall; external 'kernel32' name 'GetProfileStringA';
|
||||
|
||||
function PrintDlg(var lppd : tagPD): BOOL; stdcall; external 'comdlg32.dll' name 'PrintDlgA';
|
||||
function CommDlgExtendedError: DWORD; stdcall; external 'comdlg32.dll' name 'CommDlgExtendedError';
|
||||
|
||||
function CreateIC(lpszDriver, lpszDevice, lpszOutput: PChar; lpdvmInit: PDeviceMode): HDC; stdcall; external 'gdi32.dll' name 'CreateICA';
|
||||
function CreateDC(lpszDriver, lpszDevice, lpszOutput: PChar; lpdvmInit: PDeviceMode): HDC; stdcall; external 'gdi32.dll' name 'CreateDCA';
|
||||
function DeleteDC(DC: HDC): BOOL; stdcall; external 'gdi32.dll' name 'DeleteDC';
|
||||
function StartDoc(DC: HDC; Inf : TDocInfo): Integer; stdcall; external 'gdi32.dll' name 'StartDocA';
|
||||
function EndDoc(DC: HDC): Integer; stdcall; external 'gdi32.dll' name 'EndDoc';
|
||||
function StartPage(DC: HDC): Integer; stdcall; external 'gdi32.dll' name 'StartPage';
|
||||
function EndPage(DC: HDC): Integer; stdcall; external 'gdi32.dll' name 'EndPage';
|
||||
function AbortDoc(DC: HDC): Integer; stdcall; external 'gdi32.dll' name 'AbortDoc';
|
||||
|
||||
implementation
|
||||
|
||||
end.
|
||||
|
@ -1,249 +0,0 @@
|
||||
//WinSpool consts
|
||||
|
||||
//Commands printer
|
||||
PRINTER_CONTROL_PAUSE = 1; //Pauses the printer
|
||||
PRINTER_CONTROL_RESUME = 2; //Resumes a paused printer
|
||||
PRINTER_CONTROL_PURGE = 3; //Deletes all print jobs in the printer
|
||||
PRINTER_CONTROL_SET_STATUS = 4; //Sets the printer status.
|
||||
|
||||
//Status of Printer
|
||||
PRINTER_STATUS_PAUSED = $00000001; //The printer is paused
|
||||
PRINTER_STATUS_ERROR = $00000002; //The printer is in an error state
|
||||
PRINTER_STATUS_PENDING_DELETION = $00000004; //The printer is being deleted
|
||||
PRINTER_STATUS_PAPER_JAM = $00000008; //Paper is jammed in the printer
|
||||
PRINTER_STATUS_PAPER_OUT = $00000010; //The printer is out of paper
|
||||
PRINTER_STATUS_MANUAL_FEED = $00000020; //The printer is in a manual feed state
|
||||
PRINTER_STATUS_PAPER_PROBLEM = $00000040; //The printer has a paper problem
|
||||
PRINTER_STATUS_OFFLINE = $00000080; //The printer is offline
|
||||
PRINTER_STATUS_IO_ACTIVE = $00000100; //The printer is in an active input/output state
|
||||
PRINTER_STATUS_BUSY = $00000200; //The printer is busy
|
||||
PRINTER_STATUS_PRINTING = $00000400; //The printer is printing
|
||||
PRINTER_STATUS_OUTPUT_BIN_FULL = $00000800; //The printer's output bin is full
|
||||
PRINTER_STATUS_NOT_AVAILABLE = $00001000; //The printer is not available for printing
|
||||
PRINTER_STATUS_WAITING = $00002000; //The printer is waiting
|
||||
PRINTER_STATUS_PROCESSING = $00004000; //The printer is processing a print job
|
||||
PRINTER_STATUS_INITIALIZING = $00008000; //The printer is initializing
|
||||
PRINTER_STATUS_WARMING_UP = $00010000; //The printer is warming up
|
||||
PRINTER_STATUS_TONER_LOW = $00020000; //The printer is low on toner
|
||||
PRINTER_STATUS_NO_TONER = $00040000; //The printer is out of toner
|
||||
PRINTER_STATUS_PAGE_PUNT = $00080000; //The printer cannot print the current page.
|
||||
PRINTER_STATUS_USER_INTERVENTION = $00100000; //The printer has an error that requires the user to do something
|
||||
PRINTER_STATUS_OUT_OF_MEMORY = $00200000; //The printer has run out of memory
|
||||
PRINTER_STATUS_DOOR_OPEN = $00400000; //The printer door is open
|
||||
PRINTER_STATUS_SERVER_UNKNOWN = $00800000; //The printer status is unknown
|
||||
PRINTER_STATUS_POWER_SAVE = $01000000; //The printer is in power save mode
|
||||
|
||||
//Attribute of printer
|
||||
PRINTER_ATTRIBUTE_QUEUED = $00000001; //if set, the printer spools and starts printing after the last page is spooled. If not set and PRINTER_ATTRIBUTE_DIRECT is not set, the printer spools and prints while spooling
|
||||
PRINTER_ATTRIBUTE_DIRECT = $00000002; //Job is sent directly to the printer (it is not spooled).
|
||||
PRINTER_ATTRIBUTE_DEFAULT = $00000004; //Win9x/Me: Indicates the printer is the default printer in the system
|
||||
PRINTER_ATTRIBUTE_SHARED = $00000008; //Printer is shared
|
||||
PRINTER_ATTRIBUTE_NETWORK = $00000010; //Printer is a network printer connection
|
||||
PRINTER_ATTRIBUTE_HIDDEN = $00000020; //Reserved
|
||||
PRINTER_ATTRIBUTE_LOCAL = $00000040; //Printer is a local printer
|
||||
PRINTER_ATTRIBUTE_ENABLE_DEVQ = $00000080;
|
||||
PRINTER_ATTRIBUTE_KEEPPRINTEDJOBS = $00000100; //If set, jobs are kept after they are printed. If unset, jobs are deleted
|
||||
PRINTER_ATTRIBUTE_DO_COMPLETE_FIRST = $00000200; //If set and printer is set for print-while-spooling, any jobs that have completed spooling are scheduled to print before jobs that have not completed spooling
|
||||
PRINTER_ATTRIBUTE_WORK_OFFLINE = $00000400; //Win9x/Me: Indicates whether the printer is currently connected. If the printer is not currently connected, print jobs will continue to spool.
|
||||
PRINTER_ATTRIBUTE_ENABLE_BIDI = $00000800; //Win9x/Me: Indicates whether bi-directional communications are enabled for the printer
|
||||
PRINTER_ATTRIBUTE_RAW_ONLY = $00001000; //Indicates that only raw data type print jobs can be spooled
|
||||
|
||||
|
||||
//Jobs priorities of printer
|
||||
NO_PRIORITY = 0; //no priority
|
||||
MAX_PRIORITY = 99; //Maximum priority value
|
||||
MIN_PRIORITY = 1; //Minimum priority value
|
||||
DEF_PRIORITY = 1; //Default value of priority
|
||||
|
||||
JOB_CONTROL_PAUSE = 1;
|
||||
JOB_CONTROL_RESUME = 2;
|
||||
JOB_CONTROL_CANCEL = 3;
|
||||
JOB_CONTROL_RESTART = 4;
|
||||
JOB_CONTROL_DELETE = 5;
|
||||
JOB_CONTROL_SENT_TO_PRINTER = 6;
|
||||
JOB_CONTROL_LAST_PAGE_EJECTED = 7;
|
||||
|
||||
JOB_STATUS_PAUSED = $00000001;
|
||||
JOB_STATUS_ERROR = $00000002;
|
||||
JOB_STATUS_DELETING = $00000004;
|
||||
JOB_STATUS_SPOOLING = $00000008;
|
||||
JOB_STATUS_PRINTING = $00000010;
|
||||
JOB_STATUS_OFFLINE = $00000020;
|
||||
JOB_STATUS_PAPEROUT = $00000040;
|
||||
JOB_STATUS_PRINTED = $00000080;
|
||||
JOB_STATUS_DELETED = $00000100;
|
||||
JOB_STATUS_BLOCKED_DEVQ = $00000200;
|
||||
JOB_STATUS_USER_INTERVENTION = $00000400;
|
||||
JOB_STATUS_RESTART = $00000800;
|
||||
|
||||
JOB_POSITION_UNSPECIFIED = 0;
|
||||
|
||||
DI_CHANNEL = 1;
|
||||
DI_READ_SPOOL_JOB = 3;
|
||||
|
||||
FORM_USER = $00000000;
|
||||
FORM_BUILTIN = $00000001;
|
||||
FORM_PRINTER = $00000002;
|
||||
|
||||
PORT_TYPE_WRITE = $0001;
|
||||
PORT_TYPE_READ = $0002;
|
||||
PORT_TYPE_REDIRECTED = $0004;
|
||||
PORT_TYPE_NET_ATTACHED = $0008;
|
||||
|
||||
PORT_STATUS_TYPE_ERROR = 1;
|
||||
PORT_STATUS_TYPE_WARNING= 2;
|
||||
PORT_STATUS_TYPE_INFO = 3;
|
||||
|
||||
PORT_STATUS_OFFLINE = 1;
|
||||
PORT_STATUS_PAPER_JAM = 2;
|
||||
PORT_STATUS_PAPER_OUT = 3;
|
||||
PORT_STATUS_OUTPUT_BIN_FULL = 4;
|
||||
PORT_STATUS_PAPER_PROBLEM = 5;
|
||||
PORT_STATUS_NO_TONER = 6;
|
||||
PORT_STATUS_DOOR_OPEN = 7;
|
||||
PORT_STATUS_USER_INTERVENTION= 8;
|
||||
PORT_STATUS_OUT_OF_MEMORY = 9;
|
||||
PORT_STATUS_TONER_LOW = 10;
|
||||
PORT_STATUS_WARMING_UP = 11;
|
||||
PORT_STATUS_POWER_SAVE = 12;
|
||||
|
||||
PRINTER_ENUM_DEFAULT = $00000001;
|
||||
PRINTER_ENUM_LOCAL = $00000002;
|
||||
PRINTER_ENUM_CONNECTIONS = $00000004;
|
||||
PRINTER_ENUM_FAVORITE = $00000004;
|
||||
PRINTER_ENUM_NAME = $00000008;
|
||||
PRINTER_ENUM_REMOTE = $00000010;
|
||||
PRINTER_ENUM_SHARED = $00000020;
|
||||
PRINTER_ENUM_NETWORK = $00000040;
|
||||
PRINTER_ENUM_EXPAND = $00004000;
|
||||
PRINTER_ENUM_CONTAINER = $00008000;
|
||||
PRINTER_ENUM_ICONMASK = $00ff0000;
|
||||
PRINTER_ENUM_ICON1 = $00010000;
|
||||
PRINTER_ENUM_ICON2 = $00020000;
|
||||
PRINTER_ENUM_ICON3 = $00040000;
|
||||
PRINTER_ENUM_ICON4 = $00080000;
|
||||
PRINTER_ENUM_ICON5 = $00100000;
|
||||
PRINTER_ENUM_ICON6 = $00200000;
|
||||
PRINTER_ENUM_ICON7 = $00400000;
|
||||
PRINTER_ENUM_ICON8 = $00800000;
|
||||
|
||||
PRINTER_NOTIFY_TYPE = $00;
|
||||
JOB_NOTIFY_TYPE = $01;
|
||||
|
||||
PRINTER_NOTIFY_FIELD_SERVER_NAME = $00;
|
||||
PRINTER_NOTIFY_FIELD_PRINTER_NAME = $01;
|
||||
PRINTER_NOTIFY_FIELD_SHARE_NAME = $02;
|
||||
PRINTER_NOTIFY_FIELD_PORT_NAME = $03;
|
||||
PRINTER_NOTIFY_FIELD_DRIVER_NAME = $04;
|
||||
PRINTER_NOTIFY_FIELD_COMMENT = $05;
|
||||
PRINTER_NOTIFY_FIELD_LOCATION = $06;
|
||||
PRINTER_NOTIFY_FIELD_DEVMODE = $07;
|
||||
PRINTER_NOTIFY_FIELD_SEPFILE = $08;
|
||||
PRINTER_NOTIFY_FIELD_PRINT_PROCESSOR = $09;
|
||||
PRINTER_NOTIFY_FIELD_PARAMETERS = $0A;
|
||||
PRINTER_NOTIFY_FIELD_DATATYPE = $0B;
|
||||
PRINTER_NOTIFY_FIELD_SECURITY_DESCRIPTOR= $0C;
|
||||
PRINTER_NOTIFY_FIELD_ATTRIBUTES = $0D;
|
||||
PRINTER_NOTIFY_FIELD_PRIORITY = $0E;
|
||||
PRINTER_NOTIFY_FIELD_DEFAULT_PRIORITY = $0F;
|
||||
PRINTER_NOTIFY_FIELD_START_TIME = $10;
|
||||
PRINTER_NOTIFY_FIELD_UNTIL_TIME = $11;
|
||||
PRINTER_NOTIFY_FIELD_STATUS = $12;
|
||||
PRINTER_NOTIFY_FIELD_STATUS_STRING = $13;
|
||||
PRINTER_NOTIFY_FIELD_CJOBS = $14;
|
||||
PRINTER_NOTIFY_FIELD_AVERAGE_PPM = $15;
|
||||
PRINTER_NOTIFY_FIELD_TOTAL_PAGES = $16;
|
||||
PRINTER_NOTIFY_FIELD_PAGES_PRINTED = $17;
|
||||
PRINTER_NOTIFY_FIELD_TOTAL_BYTES = $18;
|
||||
PRINTER_NOTIFY_FIELD_BYTES_PRINTED = $19;
|
||||
|
||||
JOB_NOTIFY_FIELD_PRINTER_NAME = $00;
|
||||
JOB_NOTIFY_FIELD_MACHINE_NAME = $01;
|
||||
JOB_NOTIFY_FIELD_PORT_NAME = $02;
|
||||
JOB_NOTIFY_FIELD_USER_NAME = $03;
|
||||
JOB_NOTIFY_FIELD_NOTIFY_NAME = $04;
|
||||
JOB_NOTIFY_FIELD_DATATYPE = $05;
|
||||
JOB_NOTIFY_FIELD_PRINT_PROCESSOR = $06;
|
||||
JOB_NOTIFY_FIELD_PARAMETERS = $07;
|
||||
JOB_NOTIFY_FIELD_DRIVER_NAME = $08;
|
||||
JOB_NOTIFY_FIELD_DEVMODE = $09;
|
||||
JOB_NOTIFY_FIELD_STATUS = $0A;
|
||||
JOB_NOTIFY_FIELD_STATUS_STRING = $0B;
|
||||
JOB_NOTIFY_FIELD_SECURITY_DESCRIPTOR = $0C;
|
||||
JOB_NOTIFY_FIELD_DOCUMENT = $0D;
|
||||
JOB_NOTIFY_FIELD_PRIORITY = $0E;
|
||||
JOB_NOTIFY_FIELD_POSITION = $0F;
|
||||
JOB_NOTIFY_FIELD_SUBMITTED = $10;
|
||||
JOB_NOTIFY_FIELD_START_TIME = $11;
|
||||
JOB_NOTIFY_FIELD_UNTIL_TIME = $12;
|
||||
JOB_NOTIFY_FIELD_TIME = $13;
|
||||
JOB_NOTIFY_FIELD_TOTAL_PAGES = $14;
|
||||
JOB_NOTIFY_FIELD_PAGES_PRINTED = $15;
|
||||
JOB_NOTIFY_FIELD_TOTAL_BYTES = $16;
|
||||
JOB_NOTIFY_FIELD_BYTES_PRINTED = $17;
|
||||
|
||||
PRINTER_NOTIFY_OPTIONS_REFRESH = $01;
|
||||
PRINTER_NOTIFY_INFO_DISCARDED = $01;
|
||||
|
||||
PRINTER_CHANGE_ADD_PRINTER = $00000001;
|
||||
PRINTER_CHANGE_SET_PRINTER = $00000002;
|
||||
PRINTER_CHANGE_DELETE_PRINTER = $00000004;
|
||||
PRINTER_CHANGE_FAILED_CONNECTION_PRINTER= $00000008;
|
||||
PRINTER_CHANGE_PRINTER = $000000FF;
|
||||
PRINTER_CHANGE_ADD_JOB = $00000100;
|
||||
PRINTER_CHANGE_SET_JOB = $00000200;
|
||||
PRINTER_CHANGE_DELETE_JOB = $00000400;
|
||||
PRINTER_CHANGE_WRITE_JOB = $00000800;
|
||||
PRINTER_CHANGE_JOB = $0000FF00;
|
||||
PRINTER_CHANGE_ADD_FORM = $00010000;
|
||||
PRINTER_CHANGE_SET_FORM = $00020000;
|
||||
PRINTER_CHANGE_DELETE_FORM = $00040000;
|
||||
PRINTER_CHANGE_FORM = $00070000;
|
||||
PRINTER_CHANGE_ADD_PORT = $00100000;
|
||||
PRINTER_CHANGE_CONFIGURE_PORT = $00200000;
|
||||
PRINTER_CHANGE_DELETE_PORT = $00400000;
|
||||
PRINTER_CHANGE_PORT = $00700000;
|
||||
PRINTER_CHANGE_ADD_PRINT_PROCESSOR = $01000000;
|
||||
PRINTER_CHANGE_DELETE_PRINT_PROCESSOR = $04000000;
|
||||
PRINTER_CHANGE_PRINT_PROCESSOR = $07000000;
|
||||
PRINTER_CHANGE_ADD_PRINTER_DRIVER = $10000000;
|
||||
PRINTER_CHANGE_SET_PRINTER_DRIVER = $20000000;
|
||||
PRINTER_CHANGE_DELETE_PRINTER_DRIVER = $40000000;
|
||||
PRINTER_CHANGE_PRINTER_DRIVER = $70000000;
|
||||
PRINTER_CHANGE_TIMEOUT = $80000000;
|
||||
PRINTER_CHANGE_ALL = $7777FFFF;
|
||||
|
||||
PRINTER_ERROR_INFORMATION = $80000000;
|
||||
PRINTER_ERROR_WARNING = $40000000;
|
||||
PRINTER_ERROR_SEVERE = $20000000;
|
||||
PRINTER_ERROR_OUTOFPAPER = $00000001;
|
||||
PRINTER_ERROR_JAM = $00000002;
|
||||
PRINTER_ERROR_OUTOFTONER = $00000004;
|
||||
|
||||
//PrintDlg Flags
|
||||
PD_ALLPAGES = $00000000;
|
||||
PD_SELECTION = $00000001;
|
||||
PD_PAGENUMS = $00000002;
|
||||
PD_NOSELECTION = $00000004;
|
||||
PD_NOPAGENUMS = $00000008;
|
||||
PD_COLLATE = $00000010;
|
||||
PD_PRINTTOFILE = $00000020;
|
||||
PD_PRINTSETUP = $00000040;
|
||||
PD_NOWARNING = $00000080;
|
||||
PD_RETURNDC = $00000100;
|
||||
PD_RETURNIC = $00000200;
|
||||
PD_RETURNDEFAULT = $00000400;
|
||||
PD_SHOWHELP = $00000800;
|
||||
PD_ENABLEPRINTHOOK = $00001000;
|
||||
PD_ENABLESETUPHOOK = $00002000;
|
||||
PD_ENABLEPRINTTEMPLATE = $00004000;
|
||||
PD_ENABLESETUPTEMPLATE = $00008000;
|
||||
PD_ENABLEPRINTTEMPLATEHANDLE = $00010000;
|
||||
PD_ENABLESETUPTEMPLATEHANDLE = $00020000;
|
||||
PD_USEDEVMODECOPIES = $00040000;
|
||||
PD_USEDEVMODECOPIESANDCOLLATE = $00040000;
|
||||
PD_DISABLEPRINTTOFILE = $00080000;
|
||||
PD_HIDEPRINTTOFILE = $00100000;
|
||||
PD_NONETWORKBUTTON = $00200000;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user