Back

// PSLProcessor.cpp : Implementation of CPSLProcessor

#include "stdafx.h"
#include "PSLProcessor.h"


CPSLProcessor::CPSLProcessor()
{
   m_sName = _T("");
   CRegKey key;
   if(key.Open(HKEY_LOCAL_MACHINE, _T("HARDWARE\\DESCRIPTION\\System\\CentralProcessor\\0"), KEY_READ) == ERROR_SUCCESS)
   {
      tstring cpuName;
      cpuName.resize(64);
      ULONG nChars = 64;
      if(key.QueryStringValue(_T("ProcessorNameString"), (LPTSTR)cpuName.c_str(), &nChars) == ERROR_SUCCESS)
      {
         remove_repeat(cpuName, ' ');
         m_sName = cpuName.c_str();
      }
      key.Close();
   }
}

HRESULT CPSLProcessor::FinalConstruct()
{
   return S_OK;
}

void CPSLProcessor::FinalRelease()
{
}

////////////////////////////////////////////////////////////////////////
// Interface Implementation;
////////////////////////////////////////////////////////////////////////

STDMETHODIMP CPSLProcessor::get_Cores(IPSLCores ** ppValue)
{
   PSL_BEGIN

   *ppValue = m_Cores;

   PSL_END
}

STDMETHODIMP CPSLProcessor::get_Name(BSTR * pValue)
{
   PSL_BEGIN

   *pValue = m_sName.copy();

   PSL_END
}

STDMETHODIMP CPSLProcessor::get_Usage(short * pValue)
{
   PSL_BEGIN

   *pValue = m_Usage.GetUsage();

   PSL_END
}

Top