pizzalocimp.cpp

来自「VC++串口通信设。本书详细说明讲解了在VC++环境下编写串口通信得过程。值得一」· C++ 代码 · 共 61 行

CPP
61
字号
// Get needed include files
#define INITGUID
#include "PizzaLocImp.h"
#include "Utility.h"


//
// Constructor and destructor
//

ComPizzaLocator::ComPizzaLocator()
{
   VerboseMsg("In PizzaLocator constructor.\n");
}

ComPizzaLocator::~ComPizzaLocator()
{
   VerboseMsg("In PizzaLocator destructor.\n");
}


//
// IPizzaLocator interface members
//

STDMETHODIMP
ComPizzaLocator::Locate(LPOLESTR      pszItemName,
                        REFIID        riidResult,
                        PPVOID        ppvResult)
{
   HRESULT hResult;
   VerboseMsg("In Locate.\n");

   USES_CONVERSION;

   // Create a moniker for the PizzaMaker server
   IMoniker* pIMoniker = NULL;
   hResult = CreateFileMoniker(pszItemName,
                               &pIMoniker);
   if (FAILED(hResult)) {
      // We'll let the client report the error
      // ReportError("Could not create file moniker.", hResult);
      return hResult;
   }

   // Check to see if there is a registered object
   hResult = BindMoniker(pIMoniker, 0, riidResult, ppvResult);
   if (FAILED(hResult)) {
      // We'll let the client report the error
      // ReportError("Could not bind to moniker.", hResult);
      return hResult;
   }

   // Clean up our various interface pointers
   pIMoniker->Release();
   pIMoniker = NULL;

   return NOERROR;
}

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?