00001
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027 #ifndef _PRINTERINSTALL_H_
00028 #define _PRINTERINSTALL_H_
00029
00030 #include "CCTChar.h"
00031 #include <vector>
00032
00034 typedef std::vector<std::tstring> STRARRAY;
00035
00037 #define DRIVER_FILE_NUM 0
00039 #define UI_FILE_NUM 1
00041 #define HELP_FILE_NUM 2
00043 #define DATA_FILE_NUM 3
00044
00046 std::tstring ConcatPaths(const std::tstring& sFolder, const std::tstring& sPathname, bool bAllowAbsoluteOverride = true);
00047
00051 class PrinterInstall
00052 {
00053 public:
00054
00056 PrinterInstall(LPCTSTR lpPrinterName, LPCTSTR lpPortName, LPCTSTR lpDriverName, LPCTSTR lpHardwareID, const LPCTSTR* pFiles);
00058 PrinterInstall();
00059
00060 protected:
00061
00063 std::tstring m_sPrinterName;
00065 std::tstring m_sPortName;
00067 std::tstring m_sDriverName;
00069 std::tstring m_sHardwareID;
00071 std::tstring m_sPortMonitor;
00073 STRARRAY m_arFiles;
00075 int m_nError;
00077 int m_nLastError;
00079 bool m_bLockError;
00080
00081 bool m_bX64;
00082
00083
00084 public:
00085
00090 int GetError() const {return m_nError;};
00095 int GetLastError() const {return m_nLastError;};
00097 void InitializePrinterData(LPCTSTR lpPrinterName, LPCTSTR lpPortName, LPCTSTR lpDriverName, LPCTSTR lpHardwareID, const LPCTSTR* pFiles);
00098
00099 public:
00100
00102 int Install(LPCTSTR lpFilesPath, HWND hParent);
00104 int Uninstall(HWND hParent);
00106 bool DoCommandLine(int nArgs, TCHAR** pArgs, bool& bNoUI, LPCTSTR lpRelativeDriverFolder);
00108 bool AddPortMonitor(LPCTSTR lpMonitorName, LPCTSTR lpMonitorFile, LPCTSTR lpFilePath);
00110 bool RemovePortMonitor(LPCTSTR lpMonitorName);
00112 bool IsPrinterInstalled(bool& bInstalled);
00113
00114 protected:
00115
00117 bool DoAddPort();
00119 bool DoDeletePort(HWND hWnd);
00121 bool DoCopyFiles(LPCTSTR lpCopyFrom);
00123 bool DoRemoveFiles();
00125 bool DoInstallPrinterDriver();
00127 bool DoUninstallPrinterDriver();
00129 bool DoAddPrinter();
00131 bool DoRemovePrinter(LPTSTR lpName);
00133 bool DoRemovePrinters();
00134
00136 void SetError(int nError);
00140 void ResetError() {m_nError = 0; m_nLastError = 0; m_bLockError = false;};
00141 };
00142
00143 #endif //#define _PRINTERINSTALL_H_