找了半天也找不到,想做一个查看打印机状态的程序,要调用EnumJobs的API函数,可他里边有一个参数是JOB_INFO_1结构体,可从网上怎么也找不到介绍这个结构体成员的文章,只好上MSDN找,可MSDN也找来找去找不到,还请大家帮忙呀!

解决方案 »

  1.   

    MSDN到底哪个地方是API资料库呀(或称API大全)
      

  2.   

    你用的哪个MSDN版本?
    目录树-Win32和COM开发
    或者在“索引”页,把筛选依据设为“未筛选”,输入你想要找的函数名,就能找到
      

  3.   

    头文件中都有定义的,在本地安装Visual Studio的目录下找就行了。另外下面的一篇文章可以参考以下:
    http://support.microsoft.com/kb/821769/zh-cn
      

  4.   

    关键的链接忘了帖了。
    http://msdn2.microsoft.com/en-gb/library/ms535514.aspx
    http://msdn2.microsoft.com/en-gb/library/ms535687.aspx
      

  5.   

    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: Job is sent to the printer, but the job may not be printed yet. See Res 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_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. Res
    Windows XP: Port monitors that do not support TrueEndOfJob will set the job as JOB_STATUS_PRINTED right after the job is submitted to the printer.Requirements 
      Windows NT/2000/XP: Included in Windows NT 3.1 and later.
      Windows 95/98/Me: Included in Windows 95 and later.
      Header: Declared in Winspool.h; include Windows.h.
      Unicode: Declared as Unicode and ANSI structures.
      

  6.   

    忘记说了,在下要的是上msdn网站上找,本人机器上没有安装MSDNJOB_INFO_1 我已经用上了,可是发现不管打印机是否缺纸/无色带(热升华打印机)等特殊情况,返回Status都是和正常打印一样,是0x10(16),现在我想用JOB_INFO_2实验一下,请问哪位有这个结构的资料或获取打印机打印任务详细信息的资料?
      

  7.   

    typedef struct _JOB_INFO_2 { 
      DWORD      JobId; 
      LPTSTR     pPrinterName; 
      LPTSTR     pMachineName; 
      LPTSTR     pUserName; 
      LPTSTR     pDocument; 
      LPTSTR     pNotifyName; 
      LPTSTR     pDatatype; 
      LPTSTR     pPrintProcessor; 
      LPTSTR     pParameters; 
      LPTSTR     pDriverName; 
      LPDEVMODE  pDevMode; 
      LPTSTR     pStatus; 
      PSECURITY_DESCRIPTOR pSecurityDescriptor; 
      DWORD      Status; 
      DWORD      Priority; 
      DWORD      Position; 
      DWORD      StartTime; 
      DWORD      UntilTime; 
      DWORD      TotalPages; 
      DWORD      Size; 
      SYSTEMTIME Submitted; 
      DWORD      Time; 
      DWORD      PagesPrinted; 
    } JOB_INFO_2, *PJOB_INFO_2; 
    Members
    JobId 
    Specifies a job identifier value. 
    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 who 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"). 
    pNotifyName 
    Pointer to a null-terminated string that specifies the name of the user who should be notified when the job has been printed or when an error occurs while printing the job. 
    pDatatype 
    Pointer to a null-terminated string that specifies the type of data used to record the print job. 
    pPrintProcessor 
    Pointer to a null-terminated string that specifies the name of the print processor that should be used to print the job. 
    pParameters 
    Pointer to a null-terminated string that specifies print-processor parameters. 
    pDriverName 
    Pointer to a null-terminated string that specifies the name of the printer driver that should be used to process the print job. 
    pDevMode 
    Pointer to a DEVMODE structure that contains device-initialization and environment data for the printer driver. 
    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. 
    pSecurityDescriptor 
    The value of this member is NULL. Retrieval and setting of document security descriptors is not supported in this release. 
    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: Job is sent to the printer, but the job may not be printed yet. See Res 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_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. 
    StartTime 
    Specifies the earliest time that the job can be printed. 
    UntilTime 
    Specifies the latest time that the job can be printed. 
    TotalPages 
    Specifies the number of pages required for the job. This value may be zero if the print job does not contain page delimiting information. 
    Size 
    Specifies the size, in bytes, of the job. 
    Submitted 
    A SYSTEMTIME structure that specifies the time when the job was submitted. 
    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. Time 
    Specifies the total time, in milliseconds, that has elapsed since the job began printing. 
    PagesPrinted 
    Specifies the number of pages that have printed. This value may be zero if the print job does not contain page delimiting information. 
    Res
    Windows XP: Port monitors that do not support TrueEndOfJob will set the job as JOB_STATUS_PRINTED right after the job is submitted to the printer.Requirements 
      Windows NT/2000/XP: Included in Windows NT 3.1 and later.
      Windows 95/98/Me: Included in Windows 95 and later.
      Header: Declared in Winspool.h; include Windows.h.
      Unicode: Declared as Unicode and ANSI structures.
      

  8.   

    typedef struct _JOB_INFO_3 { 
      DWORD      JobId; 
      DWORD      NextJobId; 
      DWORD      Reserved; 
    } JOB_INFO_3, *PJOB_INFO_3; 
    Members
    JobId 
    Print job identifier. 
    NextJobId 
    Print job identifier for the next print job in the linked set of print jobs. 
    Reserved 
    This value is reserved for future use. You must set it to zero. 
      

  9.   

    这个网站,专门作API相关资料的,免费的
    http://www.pinvoke.net/
      

  10.   

    谢谢 qyl2008()我用了JOB_INFO_2了,但是他的Status的返回值还是16(不管缺纸还是缺墨还是正常打印),
    请问这是为什么呢?是不是JOB_INFO_1和JOB_INFO_2获取不了了,如果我暂停/停止打印的过程中能获取Status为17/21能用中文和咱说说吗?看上边两篇头有点大
      

  11.   

    不好意思啊,我也没用过,我是在MSND上查到直接发上来了
    你哪句没看明白?全翻译出来有点累,呵呵
      

  12.   

    推荐你一个网站:
    http://www.pinvoke.net/index.aspx
    有Win32 API的详细资料~~~
      

  13.   

    pStatus的值检查了吗?上面说应先检查pStatus ,若pStatus 为NULL再检查Status 的值
      

  14.   

    qyl2008() 能帮我查一下 pStatus 的具体功能?他都有哪些状态? 上边介绍的不是说他表示打印机的状态吗?怎么没有具体介绍呢?我这里实在是找不到,baidu google yahoo都找不到先谢了
      

  15.   

    http://www.ccw.com.cn/applic/prog/htm2003/20031015_115P3.htm
    看看这篇文章看是否有帮助
      

  16.   

    http://www.ccw.com.cn/applic/prog/htm2003/20031015_115P3.htm
    http://support.microsoft.com/kb/q160129/
    http://unit.cug.edu.cn/wlzx/wlfw/delphi/delphi_5%B1%E0%B3%CC%CA%B5%C0%FD%D3%EB%BC%BC%C7%C9/07.pdf