deskband.cpp
Upload User: xhy777
Upload Date: 2007-02-14
Package Size: 24088k
Code Size: 2k
Category:

Windows Kernel

Development Platform:

Visual C++

  1. //+-------------------------------------------------------------------------
  2. //
  3. //  Copyright (C) Microsoft, 1997
  4. //
  5. //  File:       IDeskBand.cpp
  6. //
  7. //  Contents:   CPreviewBand::IDeskBand methods
  8. //
  9. //  History:    7-24-97  Davepl  Created
  10. //
  11. //--------------------------------------------------------------------------
  12. #include "stdafx.h"
  13. #include "PreviewBand.h"
  14. //
  15. // IObjectWithSite::GetBandInfo for CPreviewBand
  16. //
  17. const int CPreviewBand::m_MIN_SIZE_X = 20;
  18. const int CPreviewBand::m_MIN_SIZE_Y = 20;
  19. STDMETHODIMP CPreviewBand::GetBandInfo(DWORD dwBandID, DWORD dwViewMode, DESKBANDINFO* pdbi)
  20. {
  21.     if(NULL == pdbi)
  22.     {
  23.         return E_INVALIDARG;
  24.     }
  25.     else
  26.     {
  27.         m_dwBandID = dwBandID;
  28.         m_dwViewMode = dwViewMode;
  29.         if(pdbi->dwMask & DBIM_MINSIZE)
  30.         {
  31.             pdbi->ptMinSize.x = m_MIN_SIZE_X;
  32.             pdbi->ptMinSize.y = m_MIN_SIZE_Y;
  33.         }
  34.         if(pdbi->dwMask & DBIM_MAXSIZE)
  35.         {
  36.             pdbi->ptMaxSize.x = -1;
  37.             pdbi->ptMaxSize.y = -1;
  38.         }
  39.         if(pdbi->dwMask & DBIM_INTEGRAL)
  40.         {
  41.             pdbi->ptIntegral.x = 1;
  42.             pdbi->ptIntegral.y = 1;
  43.         }
  44.         if(pdbi->dwMask & DBIM_ACTUAL)
  45.         {
  46.             pdbi->ptActual.x = 0;
  47.             pdbi->ptActual.y = 0;
  48.         }
  49.         if(pdbi->dwMask & DBIM_TITLE)
  50.         {
  51.             #ifdef UNICODE
  52.                 LoadStringW(pdbi->wszTitle, IDS_BANDNAME);
  53.             #else
  54.                 CHAR szAnsi[MAX_PATH];
  55.                 LoadStringA(_Module.m_hInstResource, IDS_BANDNAME, szAnsi, MAX_PATH);
  56.                 MultiByteToWideChar(CP_ACP, 0, szAnsi, MAX_PATH, pdbi->wszTitle, MAX_PATH);
  57.             #endif
  58.         }
  59.         if(pdbi->dwMask & DBIM_MODEFLAGS)
  60.         {
  61.             pdbi->dwModeFlags = DBIMF_VARIABLEHEIGHT;
  62.         }
  63.    
  64.         if(pdbi->dwMask & DBIM_BKCOLOR)
  65.         {
  66.             //Use the default background color by removing this flag.
  67.             pdbi->dwMask &= ~DBIM_BKCOLOR;
  68.         }
  69.         return S_OK;
  70.     }
  71. }