00001 /****************************************************************************** 00002 00003 Header File: Profile Management UI.H 00004 00005 Defines the class(es) used in implementing the ICM 2.0 UI. Most of these are 00006 defined in other headers, but are assembled here by reference. 00007 00008 Copyright (c) 1996, 1997 by Microsoft Corporation. All Rights Reserved. 00009 00010 A Pretty Penny Enterprises Production 00011 00012 Change History: 00013 00014 10-24-96 [email protected] (Pretty Penny Enterprises) began coding this 00015 01-08-97 [email protected] Added color printer determination function to 00016 the CGlobals class. 00017 00018 ******************************************************************************/ 00019 00020 #undef WIN32_LEAN_AND_MEAN 00021 #if !defined(STRICT) 00022 #define STRICT 00023 #endif 00024 00025 #include <Windows.H> 00026 #include <commctrl.h> 00027 #include <crtdbg.h> 00028 #include <dlgs.h> 00029 #include <icmpriv.h> 00030 00031 // #include "PropDlg.H" 00032 #include "ProfInfo.H" 00033 #include "ProfAssoc.H" 00034 #include "Resource.H" 00035 #include "DevProp.H" 00036 #include "IcmUIHlp.H" 00037 00038 // To handle various globals, etc., we implement the following class (with no 00039 // non-static members). I'll admit to being a real bigot about global data. 00040 00041 class CGlobals { 00042 static int m_icDLLReferences; 00043 static HMODULE m_hmThisDll; 00044 // List of profiles kept here to speed GetIconLocation up 00045 static CStringArray m_csaProfiles; 00046 static BOOL m_bIsValid; 00047 00048 public: 00049 00050 static void Attach() { m_icDLLReferences++; } 00051 static void Detach() { m_icDLLReferences--; } 00052 static int& ReferenceCounter() { return m_icDLLReferences; } 00053 static void SetHandle(HMODULE hmNew) { 00054 if (!m_hmThisDll) 00055 m_hmThisDll = hmNew; 00056 } 00057 00058 static HMODULE Instance() { 00059 return m_hmThisDll; 00060 } 00061 00062 static HRESULT CanUnload() { 00063 return (!m_icDLLReferences && CShellExtensionPage::OKToClose()) ? 00064 S_OK : S_FALSE; 00065 } 00066 00067 // Error routine to report problems via a Message box. Pass the String ID 00068 // of the error... 00069 00070 static void Report(int idError, HWND hwndParent = NULL); 00071 static int ReportEx(int idError, HWND hwndParent, BOOL bSystemMessage, UINT uType, DWORD dwNumMsg, ...); 00072 00073 // Routines for maintenance of a cached set of installed profiles to speed 00074 // up GetIconLocation 00075 00076 static BOOL IsInstalled(CString& csProfile); 00077 static void InvalidateList() { m_bIsValid = FALSE; } 00078 00079 00080 // Routine for determining a printer's hdc 00081 // Caller is responsible for calling DeleteDC() on 00082 // the returned value. 00083 // Note that this routine uses CreateIC() to get an 00084 // information context rather than CreateDC() to get the 00085 // device context. 00086 static HDC GetPrinterHDC(LPCTSTR lpctstrName); 00087 00088 // Routine for determining if a printer is monochrome or color 00089 static BOOL ThisIsAColorPrinter(LPCTSTR lpctstrName); 00090 }; 00091