📄 prutils.h
字号:
/* * * prutils.h * Copyright (C) 2006 Michael H. Overlin This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA Contact at poster_printer@yahoo.com */#ifndef PRUTILS_H#define PRUTILS_H#include "printResizerCommon.h"#include "types.h"#include <windows.h>#include <winspool.h>// WHEN CONVERTING AN INTEGRAL TYPE(DWORD, INT, ETC) TO A STRING, NO MORE THAN 4 DIGITS PER BYTE IS NEEDED#define MAX_PRINTED_DIGITS(integral_type) (sizeof(integral_type) * 4)BOOL CheckIsPrintResizer(OUT BOOL& bIsPrintResizer, IN LPCTSTR lptstrPrinterName) ;BOOL CheckPrinterDriverInstalled(OUT ::PDRIVER_INFO_3& out_pinfoDrivers, OUT uint& out_kDriver, IN LPCTSTR lptstrDriverName) ;// CALLER RESPONSIBLE FOR FREEING MALLOC'D BUFFERLPTSTR ChooseTargetPrinterNameWithoutUserInput(void) ;void ComposeDialogTitle(IN ::PrintResizerComponent comp, OUT tstring& tstrTitle, IN LPCTSTR lptstrSubject) ;BOOL ConfirmationMessage(IN ::PrintResizerComponent comp, IN HWND hwndParent, IN LPCTSTR lptstrMessage);void ErrorMessage(IN ::PrintResizerComponent comp, IN HWND hwndParent, IN LPCTSTR lptstrMessage);void ErrorExit(IN ::PrintResizerComponent comp, IN HWND hwndParent, IN DWORD dwErrorCode);void ErrorExit(IN ::PrintResizerComponent comp, IN HWND hwndParent, IN LPCTSTR lptstrMessage) ;BOOL FillComboWithInstalledPrinters(HWND hwndCombo, BOOL bAllowPrintResizer) ;BOOL FillListWithInstalledPrinters(HWND hwndList, BOOL bAllowPrintResizer) ;BOOL FindStringInCombo(OUT PDWORD pdwFoundIndex, IN LPCTSTR lptstrFind, IN HWND hwndCtrl) ;BOOL GetComboCurSelLBText(OUT class ItemBuffer& buff, IN HWND hwndCombo) ;BOOL GetComboLBText(OUT class ItemBuffer& buff, IN WPARAM itemIndex, IN HWND hwndCombo) ;LPTSTR GetInstalledGPLRTFTextFileName(void) ;// CALLER RESPONSIBLE FOR FREEING MALLOC'D BUFFER// IF dwErr DOESN'T HAVE BET 29 SET, CALLS GetSystemErrorMessageLPTSTR GetPRErrorMessage(IN DWORD dwErr);// ON SUCCESS, TEMP FILE NAME WRITTEN, PREVIEW APP NAME RETURNED. ON FAILURE, RETURNS NULL// CALLER IS RESPONSIBLE FOR "free" 'ing RETURN, NULL INDICATES FAILURE// dwcChBuff MUST BE AT LEAST MAX_PATH + 1 // DEBUG / FIX CHECK THE ABOVE, MAX_PATH PROB. OKLPTSTR GetPreviewAppFullNameAndFullTempFileName(IN HANDLE hPrinter, OUT LPTSTR lptstrTempFileName, IN DWORD dwcChBuff) ;// CALLER IS RESPONSIBLE FOR "free" 'ing RETURN, NULL INDICATES FAILURELPTSTR GetPreviewAppFullFileName(IN HANDLE hPrinter);#if 0// RETURN IS NUMBER SIZE IN CCH OF BUFFER ON SUCCESS. IF dwcChBuff IS SMALLER, NO WRITE OCCURS// ON FAILURE RETURN IS 0DWORD GetPreviewAppFullFileName(LPTSTR lptstrFileName, DWORD dwcChBuff) ;#endif// dwcChBuff MUST BE AT LEAST MAX_PATH + 1 BOOL GetFullTempFileName(LPTSTR lptstrTempFileName, DWORD dwcChBuff) ;BOOL IsScreenResolutionOK(void) ;BOOL IsPrintResizer(IN const ::PRINTER_INFO_2& info2);// dwcChBuff SHOULD BE AT LEAST MAX_TEMP_PATH_CCH+1 (TO AVOID USING CURRENT DIRECTORY) AND MUST BE AT LEAST 3void MyGetTempPath(LPTSTR lptstrPath, DWORD dwcChBuff) ;void NotificationMessage(IN ::PrintResizerComponent comp, IN HWND hwndParent, IN LPCTSTR lptstrMessage) ;// THE PRINT PROCESSOR RECEIVES THE DATA TEMP FILE NAME AND THE HWND FOR THE PREVIEW APP// AS ITS PARAMETER IN A STRING OF THE FORM "<TEMP FILE NAME>,<HWND AS UNSIGNED LONG>"// CACULATE THE MAXIMUM SIZE BUFFER NEEDED// USING A ulong TO PASS THE PREVIEW APP WINDOW HANDLE BETWEEN PROCESSES // (CONVERTING IT TO A STRING AND PUTTING IT IN THE PRINT PROCESSOR PARAMAETER, PERHAPS SHOULD// PASS AS A POINTER IF StringCchPrintf PRINTS THIS TYPE)#define WINDOWHANDLE_MAX_CCH MAX_PRINTED_DIGITS(ulong)// THE TEMP FILE NAME IS AT MOST MAX_PATH IN LENGTH, THEN WE HAVE A "," AND THE TERMINATING 0#define PRINTPROCESSOR_PARAMTER_MAX_CCH ( MAX_PATH + WINDOWHANDLE_MAX_CCH + 2 )struct PrintProcessorParameter { TCHAR atstrFullTempFileName[MAX_PATH+1]; HWND hwndPreviewApp;};BOOL ParsePrintProcessorParameter(OUT PrintProcessorParameter& ppp, IN LPCWSTR lpwstrParameter);DWORD WritePrintProcessorParameter(OUT LPWSTR lpwstrParameter, IN DWORD dwcChBuff, IN const PrintProcessorParameter& ppp);#endif
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -