打印监控问题(100分)

  • 主题发起人 主题发起人 yzsxj
  • 开始时间 开始时间
Y

yzsxj

Unregistered / Unconfirmed
GUEST, unregistred user!
监控网络打印机打印的内容,怎么得到打印的内容.
 
问题: 最近要想做一个打印监控程序,不知道如何做,请大家帮忙一下。 ( 积分: 150 )
分类: 打印

来自: willing66, 时间: 2005-12-20 21:31:00, ID: 3303508
我想做一个打印机监控程序,监视一台网络打印打印的内容,打印时间,谁打印的。
我想这应该打把这个程序写成一个服务,实时监听打印机的操作,但不知道如何实现。请大家帮忙指点一下。

来自: willing66, 时间: 2005-12-21 13:25:05, ID: 3304080
有没有人帮记忙顶一下呀

来自: Mike1234567890, 时间: 2005-12-22 8:32:13, ID: 3304835
你在MSDN中查一下打印相关的API函数
应该可以获得网络打印机数据的

来自: willing66, 时间: 2005-12-22 13:17:09, ID: 3305290
好的,我找一下。

来自: sbzldlb, 时间: 2005-12-22 13:21:27, ID: 3305297
我也在做打印的东西
才开始做
unit UOperPrint;

interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls,printers,winspool;

type
TOperPrint=Class
private
FPrintLMargin : Integer;
FPrintTMargin : Integer;
FPrintRMargin : Integer;
FPrintBMargin : Integer;
FFontSize : Integer;
{打印字体大小}
FFontName : String;
{打印字体名字}
FFontStyle : TFontStyles;
{打印字体}
FPrinterOrientation : TPrinterOrientation;{打印横/竖}
function GetPrintrStr:String;
function GetPrintrCount:Integer;
function ConnPrinter(PrintrStr:String):Boolean;
procedure Print;virtual;
procedure SetPrintBMargin(const Value: Integer);
procedure SetPrintLMargin(const Value: Integer);
procedure SetPrintRMargin(const Value: Integer);
procedure SetPrintTMargin(const Value: Integer);
procedure SetFontname(const Value: String);
procedure SetFontSize(const Value: Integer);
procedure SetFontStyle(const Value: TFontStyles);
procedure SetPrinterOrientation(const Value: TPrinterOrientation);
protected
property PrintLMargin:Integer Read FPrintLMargin write SetPrintLMargin;
property PrintTMargin:Integer Read FPrintTMargin write SetPrintTMargin;
property PrintRMargin:Integer Read FPrintRMargin write SetPrintRMargin;
property PrintBMargin:Integer Read FPrintBMargin write SetPrintBMargin;
property FontSize:Integer read FFontSize write SetFontSize;
property FontName:String read FFontName write SetFontname;
property FontStyle:TFontStyles read FFontStyle write SetFontStyle;
property PrinterOrientation:TPrinterOrientation read FPrinterOrientation write SetPrinterOrientation;

public
end;

type
TPrintChar=class(TOperPrint)
private
FPrintResolution : Integer;{Char缩放的范围}
FPrintProportional :Boolean;
{是否按图象比例打印}
procedure SetPrintResolution(const Value: Integer);
procedure SetPrintProportional(const Value: Boolean);
protected
property PrintResolution:Integer read FPrintResolution write SetPrintResolution;
property PrintProportional:Boolean read FPrintProportional write SetPrintProportional;
procedure Print;overload;
public
property PrintLMargin;
property PrintTMargin;
property PrintRMargin;
property PrintBMargin;
property FontSize;
property FontName;
property FontStyle;
property PrinterOrientation;
end;

implementation
{ TOperPrint }
//****************************************************************************//
// *连接打印机* //
//****************************************************************************//
function TOperPrint.ConnPrinter(PrintrStr: String): Boolean;
begin

Result:=False;
try
if AddPrinterConnection(Pchar(PrintrStr)) then
Result:=True;
except
end;

end;

//****************************************************************************//
// *得到打印机数量* //
//****************************************************************************//
function TOperPrint.GetPrintrCount: Integer;
begin

Result:=Printer.Printers.Count;

end;

//****************************************************************************//
// *得到默认打印机* //
//****************************************************************************//
function TOperPrint.GetPrintrStr: String;
begin

if GetPrintrCount>0 then
Result:=Printer.Printers.Strings[0];
end;

procedure TOperPrint.Print;
begin

end;

procedure TOperPrint.SetFontname(const Value: String);
begin

FFontName := Value;
end;

procedure TOperPrint.SetFontSize(const Value: Integer);
begin

FFontSize := Value;
end;

procedure TOperPrint.SetFontStyle(const Value: TFontStyles);
begin

FFontStyle := Value;
end;

procedure TOperPrint.SetPrintBMargin(const Value: Integer);
begin

FPrintBMargin := Value;
end;

procedure TOperPrint.SetPrinterOrientation(
const Value: TPrinterOrientation);
begin

FPrinterOrientation := Value;
end;

procedure TOperPrint.SetPrintLMargin(const Value: Integer);
begin

FPrintLMargin := Value;
end;


procedure TOperPrint.SetPrintRMargin(const Value: Integer);
begin

FPrintRMargin := Value;
end;

procedure TOperPrint.SetPrintTMargin(const Value: Integer);
begin

FPrintTMargin := Value;
end;

{ TPrintChar }
procedure TPrintChar.Print;
begin

end;

procedure TPrintChar.SetPrintProportional(const Value: Boolean);
begin

FPrintProportional := Value;
end;

procedure TPrintChar.SetPrintResolution(const Value: Integer);
begin

FPrintResolution := Value;
end;

end.


来自: sbzldlb, 时间: 2005-12-22 13:23:39, ID: 3305301
Api函数(打印相关)列表
Api函数名 函数说明 适用范围
W3.x W95 NT
AddPrinterConnection 为当前用户建立与打印机的联系 否 是 是
StartPagePrinter 开始打印机 否 是 是
StartDoc 开始打印作业 是 是 是
StartDocPrinter 开始打印作业 否 是 是
AddPrintProvidor 加入一个打印机支持器 否 是 是
AddForm 加入一个打印机窗体 否 是 是
AddPort 加入一个打印机端口 否 是 是
AddMonitor 加入一个打印机管理器 否 是 是
ShellExecute 打开或打印指定文件 否 是 是
ClosePrinter 关闭打开的打印机 否 是 是
WritePrinter 向打印机输出数据 否 是 是
AddPrinter 在打印机服务器上建立一个打印机 否 是 是
SetAbortProc 设备打印作业的放弃函数 否 是 是
SetPrinter 设置打印机信息 否 是 是
SetPrinterData 设置打印机配置 否 是 是
SetJob 设置打印作业信息 否 是 是
ResetPrinter 设置打印数据类型和设备模式值 否 是 是
DeletePrinterConnection 删除与打印机的连接 否 是 是
DeletePrintProcessor 删除打印机处理器 否 是 是
DeletePrinterDriver 删除打印机驱动程序 否 是 是
DeletePrinter 删除打印机服务器上的打印机 否 是 是
DeleteMonitor 删除打印机监视器 否 是 是
DeletePrintProvidor 删除打印机提供者 否 是 是
DeleteForm 删除打印机窗体层差 否 是 是
AbortPrinter 删除打印机缓冲文件 否 是 是
DeletePort 删除打印机端口 否 是 是
AddJob 启动一个打印作业 否 是 是
AdvancedDocumentProperties 进行打印机高级设置 否 是 是
PrintDlg 建立打印文本对话框 否 是 是
EnumPrintProcessors 枚举已安装的打印机处理器 否 是 是
EnumPrinterDrivers 枚举已安装的打印机驱动程序 否 是 是
EnumPorts 枚举可用打印机端口 否 是 是
EnumPrintProcessorDatatypes 枚举打印机所支持的数据类型 否 是 是
EnumForms 枚举所支持的打印机窗体 否 是 是
AbortDoc 终止一项打印作业 是 是 是
PrinterProperties 修改打印机属性 否 是 是
AddPrintProcessor 将打印处理器复制到打印机服务器中 否 是 是
AddPrinterDriver 将打印机驱动程序复制到打印机服务器中 否 是 是
PrinterMessageBox 显示打印作业出错信息 否 是 是
ConnectToPrinterDlg 显示浏览对话并连接网络打印机 否 是 是
EndPagePrinter 结束打印页 否 是 是
EndDoc 结束打印作业 是 是 是
EndDocPrinter 结束打印作业 否 是 是
StartPage 准备打印机接收数据 是 是 是
WaitForPrinterChange 监测打印机或打印机服务器变化 否 是 是
GetPrintProcessorDirectory 获取打印机驱动处理器路径 否 是 是
GetPrinterDriver 获取打印机驱动程序信息 否 是 是
GetPrinterDriverDirectory 获取打印机驱动程序路径 否 是 是
GetPrinter 获取打印机信息 否 是 是
GetPrinterData 获取打印机配置信息 否 是 是
GetForm 获取打印机窗口信息 否 是 是
EnumJobs 获取打印作业信息 否 是 是
GetJob 获取打印作业信息 否 是 是
OpenPrinter 获取指定打印机的句柄 否 是 是
ReadPrinter 读打印机数据 否 是 是
DocumentProperties 配置打印机设置 否 是 是
ConfigurePort 配置打印机端口 否 是 是

来自: 那一刀, 时间: 2005-12-27 21:43:27, ID: 3310719
不错,我想可以使用APIHook来实现!

问题讨论没有结束 ...
 
在网络上任意计算机得到网络打印机的内容,怎么没人回答啊?不是有人作好了嘛?
在本地是可以得到的,这个问题已解决
 
请doll_paul给个提示啊,内容怎么得到?
 
后退
顶部