Main Page | Class Hierarchy | Class List | File List | Class Members | File Members

CGlobals Class Reference

#include <icmui.h>

List of all members.

Static Public Member Functions

void Attach ()
void Detach ()
int & ReferenceCounter ()
void SetHandle (HMODULE hmNew)
HMODULE Instance ()
HRESULT CanUnload ()
void Report (int idError, HWND hwndParent=NULL)
int ReportEx (int idError, HWND hwndParent, BOOL bSystemMessage, UINT uType, DWORD dwNumMsg,...)
BOOL IsInstalled (CString &csProfile)
void InvalidateList ()
HDC GetPrinterHDC (LPCTSTR lpctstrName)
BOOL ThisIsAColorPrinter (LPCTSTR lpctstrName)

Static Private Attributes

int m_icDLLReferences = 0
HMODULE m_hmThisDll = NULL
CStringArray m_csaProfiles
BOOL m_bIsValid = FALSE


Member Function Documentation

void CGlobals::Attach  )  [inline, static]
 

Definition at line 50 of file icmui.h.

References m_icDLLReferences.

Referenced by CIcmUiFactory::CIcmUiFactory(), and CICMUserInterface::CICMUserInterface().

00050 { m_icDLLReferences++; }

HRESULT CGlobals::CanUnload  )  [inline, static]
 

Definition at line 62 of file icmui.h.

References m_icDLLReferences, and CShellExtensionPage::OKToClose().

Referenced by DllCanUnloadNow().

00062 { 00063 return (!m_icDLLReferences && CShellExtensionPage::OKToClose()) ? 00064 S_OK : S_FALSE; 00065 }

void CGlobals::Detach  )  [inline, static]
 

Definition at line 51 of file icmui.h.

References m_icDLLReferences.

Referenced by CIcmUiFactory::~CIcmUiFactory(), and CICMUserInterface::~CICMUserInterface().

00051 { m_icDLLReferences--; }

HDC CGlobals::GetPrinterHDC LPCTSTR  lpctstrName  )  [static]
 

Definition at line 97 of file shellext.cpp.

References BYTE, FALSE, GetPrinterHDC(), and NULL.

Referenced by GetPrinterHDC(), and ThisIsAColorPrinter().

00097 { 00098 00099 HANDLE hPrinter; // Get a handle on it... 00100 LPTSTR lpstrMe = const_cast <LPTSTR> (lpstrName); 00101 00102 if (!OpenPrinter(lpstrMe, &hPrinter, NULL)) { 00103 _RPTF2(_CRT_WARN, "Unable to open printer '%s'- error %d\n", lpstrName, 00104 GetLastError()); 00105 return FALSE; 00106 } 00107 00108 // First, use DocumentProperties to find the correct DEVMODE size- we 00109 // must use the DEVMODE to force color on, in case the user's defaults 00110 // have turned it off... 00111 00112 unsigned short lcbNeeded = (unsigned short) DocumentProperties(NULL, hPrinter, lpstrMe, NULL, 00113 NULL, 0); 00114 00115 if (lcbNeeded <= 0) { 00116 _RPTF2(_CRT_WARN, 00117 "Document Properties (get size) for '%s' returned %d\n", lpstrName, 00118 lcbNeeded); 00119 ClosePrinter(hPrinter); 00120 return FALSE; 00121 } 00122 00123 HDC hdcThis = NULL; 00124 00125 union { 00126 LPBYTE lpb; 00127 LPDEVMODE lpdm; 00128 }; 00129 00130 lpb = new BYTE[lcbNeeded]; 00131 00132 if (lpb) { 00133 00134 ZeroMemory(lpb,lcbNeeded); 00135 lpdm -> dmSize = lcbNeeded; 00136 lpdm -> dmFields = DM_COLOR; 00137 lpdm -> dmColor = DMCOLOR_COLOR; 00138 if (IDOK == DocumentProperties(NULL, hPrinter, lpstrMe, lpdm, lpdm, 00139 DM_IN_BUFFER | DM_OUT_BUFFER)) { 00140 00141 // Turn off ICM, since not nessesary here. 00142 // 00143 lpdm -> dmICMMethod = DMICMMETHOD_NONE; 00144 00145 // Finally, we can create the DC! 00146 // Note: we're not actually creating a DC, just an IC 00147 hdcThis = CreateIC(NULL, lpstrName, NULL, lpdm); 00148 } else { 00149 _RPTF2(_CRT_WARN, 00150 "DocumentProperties (retrieve) on '%s' failed- error %d\n", 00151 lpstrName, GetLastError()); 00152 } 00153 delete lpb; 00154 } 00155 else 00156 _RPTF2(_CRT_WARN, "ThisIsAColorPrinter(%s) failed to get %d bytes\n", 00157 lpstrName, lcbNeeded); 00158 00159 ClosePrinter(hPrinter); 00160 00161 return hdcThis; 00162 }

HMODULE CGlobals::Instance  )  [inline, static]
 

Definition at line 58 of file icmui.h.

References m_hmThisDll.

Referenced by CICMUserInterface::InvokeCommand(), and CString::Load().

00058 { 00059 return m_hmThisDll; 00060 }

void CGlobals::InvalidateList  )  [inline, static]
 

Definition at line 77 of file icmui.h.

References FALSE, and m_bIsValid.

Referenced by CProfile::Install(), and CProfile::Uninstall().

00077 { m_bIsValid = FALSE; }

BOOL CGlobals::IsInstalled CString csProfile  )  [static]
 

Definition at line 68 of file shellext.cpp.

References BOOL, CStringArray::Count(), IsInstalled(), m_bIsValid, m_csaProfiles, CString::NameOnly(), NULL, and TRUE.

Referenced by IsInstalled().

00068 { 00069 // if (!m_bIsValid) { 00070 ENUMTYPE et = {sizeof et, ENUM_TYPE_VERSION, 0, NULL}; 00071 00072 CProfile::Enumerate(et, m_csaProfiles); 00073 m_bIsValid = TRUE; 00074 // } 00075 00076 for (unsigned u = 0; u < m_csaProfiles.Count(); u++) 00077 if (!lstrcmpi(csProfile.NameOnly(), m_csaProfiles[u].NameOnly())) 00078 break; 00079 00080 return u < m_csaProfiles.Count(); 00081 }

int& CGlobals::ReferenceCounter  )  [inline, static]
 

Definition at line 52 of file icmui.h.

References m_icDLLReferences.

Referenced by CShellExtensionPage::CShellExtensionPage().

00052 { return m_icDLLReferences; }

void CGlobals::Report int  idError,
HWND  hwndParent = NULL
[static]
 

Definition at line 44 of file shellext.cpp.

References CString::Load(), MessageBoxTitle, and Report().

Referenced by Report().

00044 { 00045 CString csMessage, csTitle; 00046 00047 csMessage.Load(idError); 00048 csTitle.Load(MessageBoxTitle); 00049 00050 MessageBox(m_hwndParent, csMessage, csTitle, MB_OK|MB_ICONEXCLAMATION); 00051 }

int CGlobals::ReportEx int  idError,
HWND  hwndParent,
BOOL  bSystemMessage,
UINT  uType,
DWORD  dwNumMsg,
  ...
[static]
 

Definition at line 53 of file shellext.cpp.

References CString::Load(), CString::LoadAndFormat(), MessageBoxTitle, NULL, ReportEx(), and UINT.

Referenced by ReportEx().

00054 { 00055 CString csMessage, csTitle; 00056 va_list argList; 00057 00058 va_start(argList,dwNumMsg); 00059 csMessage.LoadAndFormat(idError,NULL,bSystemMessage,dwNumMsg,&argList); 00060 csTitle.Load(MessageBoxTitle); 00061 va_end(argList); 00062 00063 return (MessageBox(m_hwndParent, csMessage, csTitle, uType)); 00064 }

void CGlobals::SetHandle HMODULE  hmNew  )  [inline, static]
 

Definition at line 53 of file icmui.h.

References m_hmThisDll, and SetHandle().

Referenced by SetHandle().

00053 { 00054 if (!m_hmThisDll) 00055 m_hmThisDll = hmNew; 00056 }

BOOL CGlobals::ThisIsAColorPrinter LPCTSTR  lpctstrName  )  [static]
 

Definition at line 84 of file shellext.cpp.

References BOOL, FALSE, GetPrinterHDC(), and ThisIsAColorPrinter().

Referenced by ThisIsAColorPrinter().

00084 { 00085 HDC hdcThis = CGlobals::GetPrinterHDC(lpstrName); 00086 BOOL bReturn = FALSE; 00087 if (hdcThis) { 00088 bReturn = 2 < (unsigned) GetDeviceCaps(hdcThis, NUMCOLORS); 00089 DeleteDC(hdcThis); 00090 } 00091 return bReturn; 00092 }


Member Data Documentation

BOOL CGlobals::m_bIsValid = FALSE [static, private]
 

Definition at line 40 of file shellext.cpp.

Referenced by InvalidateList(), and IsInstalled().

CStringArray CGlobals::m_csaProfiles [static, private]
 

Definition at line 39 of file shellext.cpp.

Referenced by IsInstalled().

HMODULE CGlobals::m_hmThisDll = NULL [static, private]
 

Definition at line 38 of file shellext.cpp.

Referenced by Instance(), and SetHandle().

int CGlobals::m_icDLLReferences = 0 [static, private]
 

Definition at line 37 of file shellext.cpp.

Referenced by Attach(), CanUnload(), Detach(), and ReferenceCounter().


The documentation for this class was generated from the following files:
Generated on Sat May 15 19:46:27 2004 for test by doxygen 1.3.7