监控打印机 获取打印纸张的数量

ice9ying 2013-03-06 05:07:52
我可以知道打印机当前是在打印的状态,但是有没有可能获得当前任务正在打印几张纸张?
在网上查找过,但没有什么收获
跪求在线等~
...全文
971 29 打赏 收藏 转发到动态 举报
写回复
用AI写文章
29 条回复
切换为时间正序
请发表友善的回复…
发表回复
ice9ying 2013-04-09
  • 打赏
  • 举报
回复
引用 28 楼 ghost5216 的回复:
引用 27 楼 ice9ying 的回复:引用 26 楼 ribut9225 的回复:引用 25 楼 ghost5216 的回复:正在打印的页数应该是可以得到的 查询打印队列 控制面板中打印机和传真 打开打印机 当打印时 会列出文档队列 以及对应页数 这个页数应该可以得到。 估计楼主也是这个意思,楼主应该是想获取本次打印作业,一共有几页? 是的是……
PagesPrinted应该是页面数量,但是不论怎样获取的都是0
ice9ying 2013-04-08
  • 打赏
  • 举报
回复
引用 26 楼 ribut9225 的回复:
引用 25 楼 ghost5216 的回复:正在打印的页数应该是可以得到的 查询打印队列 控制面板中打印机和传真 打开打印机 当打印时 会列出文档队列 以及对应页数 这个页数应该可以得到。 估计楼主也是这个意思,楼主应该是想获取本次打印作业,一共有几页?
是的是的
ribut9225 2013-04-08
  • 打赏
  • 举报
回复
引用 25 楼 ghost5216 的回复:
正在打印的页数应该是可以得到的 查询打印队列 控制面板中打印机和传真 打开打印机 当打印时 会列出文档队列 以及对应页数 这个页数应该可以得到。
估计楼主也是这个意思,楼主应该是想获取本次打印作业,一共有几页?
ghost5216 2013-04-08
  • 打赏
  • 举报
回复
正在打印的页数应该是可以得到的 查询打印队列 控制面板中打印机和传真 打开打印机 当打印时 会列出文档队列 以及对应页数 这个页数应该可以得到。
ice9ying 2013-04-08
  • 打赏
  • 举报
回复
引用 23 楼 xiaohuh421 的回复:
打印机中剩余纸张数是没有的, 因为要识别这个, 会增加打印机的成本并且是大大增加. 所以最多能得到是否缺纸. 当然, 可能在高端的设备中可能有这样的东西
呃。。我想获取的不是剩余多少张纸,而是打印了多少张纸。。。
ghost5216 2013-04-08
  • 打赏
  • 举报
回复
引用 27 楼 ice9ying 的回复:
引用 26 楼 ribut9225 的回复:引用 25 楼 ghost5216 的回复:正在打印的页数应该是可以得到的 查询打印队列 控制面板中打印机和传真 打开打印机 当打印时 会列出文档队列 以及对应页数 这个页数应该可以得到。 估计楼主也是这个意思,楼主应该是想获取本次打印作业,一共有几页? 是的是的

GetJob
The GetJob function retrieves information about a specified print job. 

BOOL GetJob(
  HANDLE hPrinter,    // handle to printer
  DWORD JobId,        // job identifier
  DWORD Level,        // information level
  LPBYTE pJob,        // array of jobs
  DWORD cbBuf,        // bytes in array
  LPDWORD pcbNeeded   // bytes received or required
);
Level 
[in] Specifies the type of information returned in the pJob buffer. If Level is 1, pJob receives a JOB_INFO_1 structure. If Level is 2, pJob receives a JOB_INFO_2 structure. 
pJob 
[out] Pointer to a buffer that receives a JOB_INFO_1 or a JOB_INFO_2 structure containing information about the job. The buffer must be large enough to store the strings pointed to by the structure members. 
To determine the required buffer size, call GetJob with cbBuf set to zero. GetJob fails, GetLastError returns ERROR_INSUFFICIENT_BUFFER, and the pcbNeeded parameter returns the size, in bytes, of the buffer required to hold the array of structures and their data. 

JOB_INFO_1
The JOB_INFO_1 structure specifies print-job information such as the job-identifier value, the name of the printer for which the job is spooled, the name of the machine that created the print job, the name of the user that owns the print job, and so on. 

typedef struct _JOB_INFO_1 {
  DWORD  JobId;
  LPTSTR pPrinterName;
  LPTSTR pMachineName;
  LPTSTR pUserName;
  LPTSTR pDocument;
  LPTSTR pDatatype;
  LPTSTR pStatus;
  DWORD  Status;
  DWORD  Priority;
  DWORD  Position;
  DWORD  TotalPages;
  DWORD  PagesPrinted;
  SYSTEMTIME Submitted;
} JOB_INFO_1, *PJOB_INFO_1; 
Members
JobId 
Specifies a job identifier. 
pPrinterName 
Pointer to a null-terminated string that specifies the name of the printer for which the job is spooled. 
pMachineName 
Pointer to a null-terminated string that specifies the name of the machine that created the print job. 
pUserName 
Pointer to a null-terminated string that specifies the name of the user that owns the print job. 
pDocument 
Pointer to a null-terminated string that specifies the name of the print job (for example, "MS-WORD: Review.doc"). 
pDatatype 
Pointer to a null-terminated string that specifies the type of data used to record the print job. 
pStatus 
Pointer to a null-terminated string that specifies the status of the print job. This member should be checked prior to Status and, if pStatus is NULL, the status is defined by the contents of the Status member. 
Status 
Specifies the job status. This member can be one or more of the following values. Value Meaning 
JOB_STATUS_BLOCKED_DEVQ The driver cannot print the job. 
JOB_STATUS_COMPLETE Windows XP and later: Job is sent to the printer, but the job may not be printed yet. See Remarks for more information. 
JOB_STATUS_DELETED Job has been deleted. 
JOB_STATUS_DELETING Job is being deleted. 
JOB_STATUS_ERROR An error is associated with the job. 
JOB_STATUS_OFFLINE Printer is offline. 
JOB_STATUS_PAPEROUT Printer is out of paper. 
JOB_STATUS_PAUSED Job is paused. 
JOB_STATUS_PRINTED Job has printed. 
JOB_STATUS_PRINTING Job is printing. 
JOB_STATUS_RESTART Job has been restarted. 
JOB_STATUS_RETAINED Windows Vista and later: Job has been retained in the print queue and cannot be deleted.  This can be caused by the following:
1) The job was manually retained by a call to SetJob and the spooler is waiting for the job to be released.

2) The job has not finished printing and must finish printing before it can be automatically deleted.

See SetJob for more information about print job commands.
 
JOB_STATUS_SPOOLING Job is spooling. 
JOB_STATUS_USER_INTERVENTION Printer has an error that requires the user to do something. 


Priority 
Specifies the job priority. This member can be one of the following values or in the range between 1 through 99 (MIN_PRIORITY through MAX_PRIORITY). Value Meaning 
MIN_PRIORITY Minimum priority. 
MAX_PRIORITY Maximum priority. 
DEF_PRIORITY Default priority. 


Position 
Specifies the job's position in the print queue. 
TotalPages 
Specifies how many pages the document contains. This value may be zero if the print job does not contain page delimiting information. 
PagesPrinted 
Specifies the number of pages that have printed. This value may be zero if the print job does not contain page delimiting information. 
Submitted 
A SYSTEMTIME structure that specifies the time that this document was spooled. 
This time value is in Universal Time Coordinate (UTC) format. You should convert it to a local time value before displaying it. You can use the FileTimeToLocalFileTime function to perform the conversion. 
剩下的去问MSDN和度娘吧……
xiaohuh421 2013-04-07
  • 打赏
  • 举报
回复
打印机中剩余纸张数是没有的, 因为要识别这个, 会增加打印机的成本并且是大大增加. 所以最多能得到是否缺纸. 当然, 可能在高端的设备中可能有这样的东西
ice9ying 2013-04-07
  • 打赏
  • 举报
回复
引用 21 楼 jjq1011snake 的回复:
这个我还真不知道了额……我自己感觉哈,不一定对,可行。计算机每次打印都会把需要打印的信息完全的发送给打印机,里面肯定包括了打印的内容啊范围啊参数等……你看看能不能截取这个信息去完成你的操作呢?
我也是这么想啊,但没有找到。。。哎,可能我看错了什么
SNAKE-SNAKE 2013-04-07
  • 打赏
  • 举报
回复
这个我还真不知道了额……我自己感觉哈,不一定对,可行。计算机每次打印都会把需要打印的信息完全的发送给打印机,里面肯定包括了打印的内容啊范围啊参数等……你看看能不能截取这个信息去完成你的操作呢?
ice9ying 2013-04-04
  • 打赏
  • 举报
回复
引用 19 楼 jjq1011snake 的回复:
剩余多少纸,这个我感觉你是无法从打印机的信息中得到的,你能得到的撑死了就是打印机石佛缺纸。所以你这个序曲貌似没法完成额……
呃。。我想获取的不是剩余多少张纸,而是打印了多少张纸。。。
SNAKE-SNAKE 2013-04-03
  • 打赏
  • 举报
回复
剩余多少纸,这个我感觉你是无法从打印机的信息中得到的,你能得到的撑死了就是打印机石佛缺纸。所以你这个序曲貌似没法完成额……
ice9ying 2013-04-03
  • 打赏
  • 举报
回复
引用 16 楼 crjwlaq 的回复:
可以用图像识别 根据某些特征来
好高端,可是并不太实际,本身就是个小软件。
wuxupu 2013-03-28
  • 打赏
  • 举报
回复
只能从驱动入手,不过要有相关官方文档才行,不然两眼一抹黑
crjwlaq 2013-03-28
  • 打赏
  • 举报
回复
可以用图像识别 根据某些特征来
ice9ying 2013-03-28
  • 打赏
  • 举报
回复
话说。。难道就没有人能正经回答我的问题吗(╯‵□′)╯︵┻━┻ 。。。 (虽然我也多少是放弃了_(:3 」∠)_
tonforce 2013-03-27
  • 打赏
  • 举报
回复
引用 13 楼 ice9ying 的回复:
[quote=引用 12 楼 tonforce 的回复:] 继续关注...
关注有没有人来给我看着打印机吗。。。 [/quote] 非也非也,呵呵,我也挺关注这个问题
ice9ying 2013-03-27
  • 打赏
  • 举报
回复
引用 12 楼 tonforce 的回复:
继续关注...
关注有没有人来给我看着打印机吗。。。
tonforce 2013-03-27
  • 打赏
  • 举报
回复
继续关注...
ice9ying 2013-03-27
  • 打赏
  • 举报
回复
引用 10 楼 zhao4zhong1 的回复:
不是报道说中国劳动力成本低的优势已经旁落他国了吗?
本来这种优势就没有办法长久,或者说根本算不上是优势 楼是不是歪了啊。。。。
赵4老师 2013-03-25
  • 打赏
  • 举报
回复
不是报道说中国劳动力成本低的优势已经旁落他国了吗?
加载更多回复(9)

64,654

社区成员

发帖
与我相关
我的任务
社区描述
C++ 语言相关问题讨论,技术干货分享,前沿动态等
c++ 技术论坛(原bbs)
社区管理员
  • C++ 语言社区
  • encoderlee
  • paschen
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
  1. 请不要发布与C++技术无关的贴子
  2. 请不要发布与技术无关的招聘、广告的帖子
  3. 请尽可能的描述清楚你的问题,如果涉及到代码请尽可能的格式化一下

试试用AI创作助手写篇文章吧