⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 create.cpp

📁 VC++串口通信设。本书详细说明讲解了在VC++环境下编写串口通信得过程。值得一看
💻 CPP
字号:
STDAPI MyCreateInstance(REFCLSID rClsId,
                        LPUNKNOWN pUnkOuter,
                        DWORD dwClsContext,
                        REFIID rIID,
                        LPVOID *ppvInterface)
{
   HRESULT        hResult = E_PARAM;
   IClassFactory  *pIClassFactory = NULL;

   // Validate [out] parameter
   if (!ppvInterface)
	   return hResult;
   
	// Initialize returned interface pointer
   *ppvInterface = NULL;

   // Retrieve the class factory
   hResult = CoGetClassObject(rClsId, dwClsContext,
                              NULL, IID_IClassFactory,
                              (void**) &pIClassFactory);
   if (FAILED(hResult))
      return hResult;

   // Create the new object
   hResult = pIClassFactory->CreateInstance(pUnkOuter, rIID, ppvInterface);

   // We're done with the class factory
   pIClassFactory->Release();

   return hResult;
}

⌨️ 快捷键说明

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