PortList.h
上传用户:looem2003
上传日期:2014-07-20
资源大小:13733k
文件大小:2k
源码类别:

打印编程

开发平台:

Visual C++

  1. // PortList.h
  2. //
  3. //////////////////////////////////////////////////////////////////////
  4. #if !defined(AFX_PORTLIST_H__5BD71A00_2079_11D5_A737_00E07D80352D__INCLUDED_)
  5. #define AFX_PORTLIST_H__5BD71A00_2079_11D5_A737_00E07D80352D__INCLUDED_
  6. #include <windows.h>
  7. #include <string>
  8. #include <tchar.h>
  9. #include <stdio.h>
  10. #include <stdlib.h>
  11. #include <winspool.h>
  12. #include "winsplp.h"
  13. #include <shlobj.h>
  14. #include <limits.h>
  15. #if _MSC_VER > 1000
  16. #pragma once
  17. #endif // _MSC_VER > 1000
  18. #define PS_STARTDOC 0x001
  19. #define PS_OPENED 0x002
  20. typedef struct tagPort
  21. {
  22. TCHAR sPath[MAX_PATH];
  23. TCHAR  cPath[MAX_PATH];
  24. TCHAR sCurDocument[MAX_PATH];
  25. DWORD dwStatus;
  26. HANDLE hFile;
  27. TCHAR sPrinter[MAX_PATH];
  28. DWORD dwJobID;
  29. TCHAR img_format[MAX_PATH];
  30.         TCHAR img_format_ext[MAX_PATH];
  31.         TCHAR extApp[MAX_PATH];
  32.         BOOL dither;
  33. tagPort *pNext;
  34. } PORT, *LPPORT;
  35. class CPortList  
  36. {
  37. PORT *m_pFirst;
  38. public:
  39. DWORD Count();
  40. CPortList(TCHAR *sMonitorName=NULL,TCHAR *sPortDesc=NULL);
  41. virtual ~CPortList();
  42. void Save(TCHAR *sRoot);
  43. void Load(TCHAR *sRoot);
  44. void Load2(PMONITORINIT pMi);
  45. BOOL EnumPorts(LPWSTR pName, DWORD Level,LPBYTE pPorts, DWORD cbBuf, LPDWORD pcbNeeded, LPDWORD pcReturned);
  46. BOOL AddPort( TCHAR *img_format, TCHAR *cPath, TCHAR *sPath, DWORD dwStatus, TCHAR *img_format_ext, BOOL dither = FALSE, TCHAR* extApp = NULL);
  47. BOOL DeletePort(TCHAR *sPath);
  48. PORT *FindPort(TCHAR *sPath);
  49. private:
  50. TCHAR *m_sPortDesc;
  51. TCHAR *m_sMonitorName;
  52. LPBYTE CopyPortToBuffer(PORT *pPort,DWORD Level,LPBYTE pStart,LPBYTE pEnd);
  53. DWORD GetPortSize(TCHAR *pName,DWORD dwLevel);
  54. };
  55. #endif // !defined(AFX_PORTLIST_H__5BD71A00_2079_11D5_A737_00E07D80352D__INCLUDED_)