/*++ Copyright (c) 1996 Microsoft Corporation Module Name: StdAfx.h Abstract: This module contains the definitions for the base ATL methods. Author: Don Dumitru (dondu@microsoft.com) Revision History: dondu 12/04/96 created --*/ // stdafx.h : include file for standard system include files, // or project specific include files that are used frequently, // but are changed infrequently #ifndef _WIN32_WINNT #define _WIN32_WINNT 0x0400 #endif #ifdef _ATL_NO_DEBUG_CRT #include #include #include #include #include "dbgtrace.h" #define _ASSERTE _ASSERT #endif //#define _ATL_APARTMENT_THREADED #include //You may derive a class from CComModule and use it if you want to override //something, but do not change the name of _Module extern CComModule _Module; #include #if defined(_ATL_SINGLE_THREADED) #define ATL_THREADING_MODEL_VALUE L"Single" #elif defined(_ATL_APARTMENT_THREADED) #define ATL_THREADING_MODEL_VALUE L"Apartment" #else #define ATL_THREADING_MODEL_VALUE L"Both" #endif #define DECLARE_REGISTRY_RESOURCEID_EX(x,desc,progid,viprogid) \ static HRESULT WINAPI UpdateRegistry(BOOL bRegister) { \ HRESULT hrRes; \ _ATL_REGMAP_ENTRY *parme; \ \ hrRes = AtlAllocRegMapEx(&parme, \ &GetObjectCLSID(), \ &_Module, \ NULL, \ L"DESCRIPTION", \ desc, \ L"PROGID", \ progid, \ L"VIPROGID", \ viprogid, \ L"THREADINGMODEL", \ ATL_THREADING_MODEL_VALUE, \ NULL, \ NULL); \ if (!SUCCEEDED(hrRes)) { \ return (hrRes); \ } \ hrRes = _Module.UpdateRegistryFromResource(x,bRegister,parme); \ CoTaskMemFree(parme); \ return (hrRes); \ } #define DECLARE_REGISTRY_RESOURCE_EX(x,desc,progid,viprogid) \ static HRESULT WINAPI UpdateRegistry(BOOL bRegister) { \ HRESULT hrRes; \ _ATL_REGMAP_ENTRY *parme; \ \ hrRes = AtlAllocRegMapEx(&parme, \ &GetObjectCLSID(), \ &_Module, \ NULL, \ L"DESCRIPTION", \ desc, \ L"PROGID", \ progid, \ L"VIPROGID", \ viprogid, \ L"THREADINGMODEL", \ ATL_THREADING_MODEL_VALUE, \ NULL, \ NULL); \ if (!SUCCEEDED(hrRes)) { \ return (hrRes); \ } \ hrRes = _Module.UpdateRegistryFromResource(_T(#x),bRegister,parme); \ CoTaskMemFree(parme); \ return (hrRes); \ } HRESULT AtlAllocRegMapEx(_ATL_REGMAP_ENTRY **pparmeResult, const CLSID *pclsid, CComModule *pmodule, LPCOLESTR pszIndex, ...); template HRESULT AtlCreateInstanceOf(IUnknown *pUnkOuter, CComObject **pp) { // template // HRESULT WINAPI CComObject::CreateInstance(CComObject** pp) // { _ASSERTE(pp != NULL); HRESULT hRes = E_OUTOFMEMORY; CComObject* p = NULL; ATLTRY(p = new CComObject()) if (p != NULL) { // p->SetVoid(NULL); // Change this... p->SetVoid(pUnkOuter); // ... to this. p->InternalFinalConstructAddRef(); hRes = p->FinalConstruct(); p->InternalFinalConstructRelease(); if (hRes != S_OK) { delete p; p = NULL; } } *pp = p; return hRes; // } } template HRESULT AtlCreateInstanceOf(IUnknown *pUnkOuter, REFIID iidDesired, LPVOID *pp) { HRESULT hrRes; CComObject *p = NULL; _ASSERTE(pp != NULL); *pp = NULL; hrRes = AtlCreateInstanceOf(pUnkOuter,&p); if (SUCCEEDED(hrRes)) { _ASSERTE(p != NULL); p->AddRef(); hrRes = p->QueryInterface(iidDesired,pp); p->Release(); } return (hrRes); }