Leaked source code of windows server 2003
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

91 lines
2.9 KiB

  1. /******************************************************************************
  2. Header File: Profile Management UI.H
  3. Defines the class(es) used in implementing the ICM 2.0 UI. Most of these are
  4. defined in other headers, but are assembled here by reference.
  5. Copyright (c) 1996, 1997 by Microsoft Corporation. All Rights Reserved.
  6. A Pretty Penny Enterprises Production
  7. Change History:
  8. 10-24-96 a-robkj@microsoft.com (Pretty Penny Enterprises) began coding this
  9. 01-08-97 KjelgaardR@acm.org Added color printer determination function to
  10. the CGlobals class.
  11. ******************************************************************************/
  12. #undef WIN32_LEAN_AND_MEAN
  13. #if !defined(STRICT)
  14. #define STRICT
  15. #endif
  16. #include <Windows.H>
  17. #include <commctrl.h>
  18. #include <crtdbg.h>
  19. #include <dlgs.h>
  20. #include <icmpriv.h>
  21. // #include "PropDlg.H"
  22. #include "ProfInfo.H"
  23. #include "ProfAssoc.H"
  24. #include "Resource.H"
  25. #include "DevProp.H"
  26. #include "IcmUIHlp.H"
  27. // To handle various globals, etc., we implement the following class (with no
  28. // non-static members). I'll admit to being a real bigot about global data.
  29. class CGlobals {
  30. static int m_icDLLReferences;
  31. static HMODULE m_hmThisDll;
  32. // List of profiles kept here to speed GetIconLocation up
  33. static CStringArray m_csaProfiles;
  34. static BOOL m_bIsValid;
  35. public:
  36. static void Attach() { m_icDLLReferences++; }
  37. static void Detach() { m_icDLLReferences--; }
  38. static int& ReferenceCounter() { return m_icDLLReferences; }
  39. static void SetHandle(HMODULE hmNew) {
  40. if (!m_hmThisDll)
  41. m_hmThisDll = hmNew;
  42. }
  43. static HMODULE Instance() {
  44. return m_hmThisDll;
  45. }
  46. static HRESULT CanUnload() {
  47. return (!m_icDLLReferences && CShellExtensionPage::OKToClose()) ?
  48. S_OK : S_FALSE;
  49. }
  50. // Error routine to report problems via a Message box. Pass the String ID
  51. // of the error...
  52. static void Report(int idError, HWND hwndParent = NULL);
  53. static int ReportEx(int idError, HWND hwndParent, BOOL bSystemMessage, UINT uType, DWORD dwNumMsg, ...);
  54. // Routines for maintenance of a cached set of installed profiles to speed
  55. // up GetIconLocation
  56. static BOOL IsInstalled(CString& csProfile);
  57. static void InvalidateList() { m_bIsValid = FALSE; }
  58. // Routine for determining a printer's hdc
  59. // Caller is responsible for calling DeleteDC() on
  60. // the returned value.
  61. // Note that this routine uses CreateIC() to get an
  62. // information context rather than CreateDC() to get the
  63. // device context.
  64. static HDC GetPrinterHDC(LPCTSTR lpctstrName);
  65. // Routine for determining if a printer is monochrome or color
  66. static BOOL ThisIsAColorPrinter(LPCTSTR lpctstrName);
  67. };