// This is a part of the Active Template Library.
// Copyright (C) 1996-1997 Microsoft Corporation
// All rights reserved.
//
// This source code is only intended as a supplement to the
// Active Template Library Reference and related
// electronic documentation provided with the library.
// See these sources for detailed information regarding the
// Active Template Library product.
#ifndef __ATLBASE_H__
#error atlimpl.cpp requires atlbase.h to be included first
#endif
extern "C" const DECLSPEC_SELECTANY IID IID_IRegistrar = {0x44EC053B,0x400F,0x11D0,{0x9D,0xCD,0x00,0xA0,0xC9,0x03,0x91,0xD3}};
#ifndef _ATL_DLL_IMPL
extern "C" const DECLSPEC_SELECTANY CLSID CLSID_Registrar = {0x44EC053A,0x400F,0x11D0,{0x9D,0xCD,0x00,0xA0,0xC9,0x03,0x91,0xD3}};
#endif
#include <atlconv.cpp>
#ifdef _DEBUG
#include <stdio.h>
#include <stdarg.h>
#endif
#ifndef ATL_NO_NAMESPACE
namespace ATL
{
#endif
// used in thread pooling
DECLSPEC_SELECTANY UINT CComApartment::ATL_CREATE_OBJECT = 0;
#ifdef __ATLCOM_H__
/////////////////////////////////////////////////////////////////////////////
// AtlReportError
HRESULT WINAPI AtlReportError(const CLSID& clsid, UINT nID, const IID& iid,
HRESULT hRes, HINSTANCE hInst)
{
return AtlSetErrorInfo(clsid, (LPCOLESTR)MAKEINTRESOURCE(nID), 0, NULL, iid, hRes, hInst);
}
HRESULT WINAPI AtlReportError(const CLSID& clsid, UINT nID, DWORD dwHelpID,
LPCOLESTR lpszHelpFile, const IID& iid, HRESULT hRes, HINSTANCE hInst)
{
return AtlSetErrorInfo(clsid, (LPCOLESTR)MAKEINTRESOURCE(nID), dwHelpID,
lpszHelpFile, iid, hRes, hInst);
}
#ifndef OLE2ANSI
HRESULT WINAPI AtlReportError(const CLSID& clsid, LPCSTR lpszDesc,
DWORD dwHelpID, LPCSTR lpszHelpFile, const IID& iid, HRESULT hRes)
{
USES_CONVERSION_EX;
_ASSERTE(lpszDesc != NULL);
if (lpszDesc == NULL) // lpszDesc should not be NULL
{
return E_POINTER;
}
LPCOLESTR lpcoleDesc = A2COLE_EX(lpszDesc, _ATL_SAFE_ALLOCA_DEF_THRESHOLD);
if (lpcoleDesc == NULL)
{
return E_OUTOFMEMORY;
}
LPCOLESTR lpcoleHelpFile;
if (lpszHelpFile != NULL) // lpszHelpFile could be NULL
{
lpcoleHelpFile = A2CW_EX(lpszHelpFile, _ATL_SAFE_ALLOCA_DEF_THRESHOLD);
if (lpcoleHelpFile == NULL)
{
return E_OUTOFMEMORY;
}
}
else
{
lpcoleHelpFile = NULL;
}
return AtlSetErrorInfo(clsid, lpcoleDesc, dwHelpID, lpcoleHelpFile,
iid, hRes, NULL);
}
HRESULT WINAPI AtlReportError(const CLSID& clsid, LPCSTR lpszDesc,
const IID& iid, HRESULT hRes)
{
_ASSERTE(lpszDesc != NULL);
USES_CONVERSION_EX;
if (lpszDesc == NULL)
{
return E_POINTER;
}
LPCOLESTR lpcoleDesc = A2COLE_EX(lpszDesc, _ATL_SAFE_ALLOCA_DEF_THRESHOLD);
if (lpcoleDesc == NULL)
{
return E_OUTOFMEMORY;
}
return AtlSetErrorInfo(clsid, lpcoleDesc, 0, NULL, iid, hRes, NULL);
}
#endif
HRESULT WINAPI AtlReportError(const CLSID& clsid, LPCOLESTR lpszDesc,
const IID& iid, HRESULT hRes)
{
return AtlSetErrorInfo(clsid, lpszDesc, 0, NULL, iid, hRes, NULL);
}
HRESULT WINAPI AtlReportError(const CLSID& clsid, LPCOLESTR lpszDesc, DWORD dwHelpID,
LPCOLESTR lpszHelpFile, const IID& iid, HRESULT hRes)
{
return AtlSetErrorInfo(clsid, lpszDesc, dwHelpID, lpszHelpFile, iid, hRes, NULL);
}
#endif //__ATLCOM_H__
/////////////////////////////////////////////////////////////////////////////
// CComBSTR
CComBSTR& CComBSTR::operator=(const CComBSTR& src)
{
if (m_str != src.m_str)
{
if (m_str)
::SysFreeString(m_str);
m_str = src.Copy();
}
return *this;
}
CComBSTR& CComBSTR::operator=(LPCOLESTR pSrc)
{
::SysFreeString(m_str);
m_str = ::SysAllocString(pSrc);
return *this;
}
HRESULT CComBSTR::Append(LPCOLESTR lpsz, int nLen)
{
if(lpsz == NULL)
{
if(nLen != 0)
return E_INVALIDARG;
else
return S_OK;
}
int n1 = Length();
if (n1+nLen < n1)
return E_OUTOFMEMORY;
BSTR b = SysAllocStringLen(NULL, n1+nLen);
if (b == NULL)
{
return E_OUTOFMEMORY;
}
memcpy(b, m_str, n1*sizeof(OLECHAR));
memcpy(b+n1, lpsz, nLen*sizeof(OLECHAR));
b[n1+nLen] = NULL;
SysFreeString(m_str);
m_str = b;
return S_OK;
}
#ifndef OLE2ANSI
HRESULT CComBSTR::Append(LPCSTR lpsz)
{
USES_CONVERSION_EX;
if (lpsz == NULL)
{
return S_OK;
}
LPCOLESTR lpo = A2COLE_EX(lpsz, _ATL_SAFE_ALLOCA_DEF_THRESHOLD);
if (lpo == NULL)
{
return E_OUTOFMEMORY;
}
return Append(lpo, (int) ocslen(lpo));
}
CComBSTR::CComBSTR(LPCSTR pSrc)
{
m_str = A2WBSTR(pSrc);
}
CComBSTR::CComBSTR(int nSize, LPCSTR sz)
{
m_str = A2WBSTR(sz, nSize);
}
CComBSTR& CComBSTR::operator=(LPCSTR pSrc)
{
::SysFreeString(m_str);
m_str = A2WBSTR(pSrc);
return *this;
}
#endif
HRESULT CComBSTR::ReadFromStream(IStream* pStream)
{
_ASSERTE(pStream != NULL);
_ASSERTE(m_str == NULL); // should be empty
ULONG cb;
ULONG cbStrLen;
HRESULT hr = pStream->Read((void*) &cbStrLen, sizeof(cbStrLen), &cb);
if (FAILED(hr))
return hr;
if (cbStrLen != 0)
{
//subtract size for terminating NULL which we wrote out
//since SysAllocStringByteLen overallocates for the NULL
m_str = SysAllocStringByteLen(NULL, cbStrLen-sizeof(OLECHAR));
if (m_str == NULL)
hr = E_OUTOFMEMORY;
else
hr = pStream->Read((void*) m_str, cbStrLen, &cb);
}
return hr;
}
HRESULT CComBSTR::WriteToStream(IStream* pStream)
{
_ASSERTE(pStream != NULL);
ULONG cb;
ULONG cbStrLen = (ULONG)(m_str ? SysStringByteLen(m_str)+sizeof(OLECHAR) : 0);
HRESULT hr = pStream->Write((void*) &cbStrLen, sizeof(cbStrLen), &cb);
if (FAILED(hr))
return hr;
return cbStrLen ? pStream->Write((void*) m_str, cbStrLen, &cb) : S_OK;
}
/////////////////////////////////////////////////////////////////////////////
// CComVariant
CComVariant& CComVariant::operator=(BSTR bstrSrc)
{
InternalClear();
vt = VT_BSTR;
bstrVal = ::SysAllocString(bstrSrc);
if (bstrVal == NULL && bstrSrc != NULL)
{
vt = VT_ERROR;
scode = E_OUTOFMEMORY;
}
return *this;
}
CComVariant& CComVariant::operator=(LPCOLESTR lpszSrc)
{
InternalClear();
vt = VT_BSTR;
bstrVal = ::SysAllocString(lpszSrc);
if (bstrVal == NULL && lpszSrc != NULL)
{
vt = VT_ERROR;
scode = E_OUTOFMEMORY;
}
return *this;
}
#ifndef OLE2ANSI
CComVariant& CComVariant::operator=(LPCSTR lpszSrc)
{
USES_CONVERSION_EX;
InternalClear();
vt = VT_BSTR;
bstrVal = ::SysAllocString(A2COLE_EX(lpszSrc, _ATL_SAFE_ALLOCA_DEF_THRESHOLD));
if (bstrVal == NULL && lpszSrc != NULL)
{
vt = VT_ERROR;
scode = E_OUTOFMEMORY;
}
return *this;
}
#endif
CComVariant& CComVariant::operator=(bool bSrc)
{
if (vt != VT_BOOL)
{
InternalClear();
vt = VT_BOOL;
}
boolVal = bSrc ? ATL_VARIANT_TRUE : ATL_VARIANT_FALSE;
return *this;
}
CComVariant& CComVariant::operator=(int nSrc)
{
if (vt != VT_I4)
{
InternalClear();
vt = VT_I4;
}
lVal = nSrc;
return *this;
}
CComVariant& CComVariant::operator=(BYTE nSrc)
{
if (vt != VT_UI1)
{
InternalClear();
vt = VT_UI1;
}
bVal = nSrc;
return *this;
}
CComVariant& CComVariant::operator=(short nSrc)
{
if (vt != VT_I2)
{
InternalClear();
vt = VT_I2;
}
iVal = nSrc;
return *this;
}
CComVariant& CComVariant::operator=(long nSrc)
{
if (vt != VT_I4)
{
InternalClear();
vt = VT_I4;
}
lVal = nSrc;
return *this;
}
CComVariant& CComVariant::operator=(LONGLONG nSrc)
{
if (vt != VT_I8)
{
InternalClear();
vt = VT_I8;
}
llVal = nSrc;
return *this;
}
CComVariant& CComVariant::operator=(float fltSrc)
{
if (vt != VT_R4)
{
InternalClear();
vt = VT_R4;
}
fltVal = fltSrc;
return *this;
}
CComVariant& CComVariant::operator=(double dblSrc)
{
if (vt != VT_R8)
{
InternalClear();
vt = VT_R8;
}
dblVal = dblSrc;
return *this;
}
CComVariant& CComVariant::operator=(CY cySrc)
{
if (vt != VT_CY)
{
InternalClear();
v
没有合适的资源?快使用搜索试试~ 我知道了~
资源推荐
资源详情
资源评论
收起资源包目录
atl2.1+atl3.0.rar (54个子文件)
atl21
atliface.idl 2KB
statreg.h 6KB
atlbase.h 31KB
atlctl.cpp 30KB
atlctl.h 77KB
atlwin21.h 29KB
atlctrls.h 195KB
atlres.h 8KB
atlconv.h 22KB
atlframe.h 51KB
atlapp.h 11KB
atlwin21.cpp 1KB
atliface.h 11KB
atlwin.cpp 18KB
atlgdi.h 76KB
atlcom.h 67KB
build_.h 250B
statreg.cpp 32KB
atlconv.cpp 5KB
atlwin.h 45KB
atltmp.h 57KB
atlimpl.cpp 74KB
atldlgs.h 52KB
atl30
atldbcli.h 148KB
atliface.idl 13KB
statreg.h 53KB
atlbase.h 234KB
atldef.h 5KB
atlctl.cpp 459B
atldb.h 298KB
atlctl.h 133KB
atlconv.h 34KB
atlhost.h 106KB
atliface.h 75KB
atlwin.cpp 459B
atlcom.h 231KB
statreg.cpp 459B
atlsnap.h 63KB
atldbsch.h 44KB
atlconv.cpp 459B
atlwin.h 113KB
atlimpl.cpp 6KB
lib
ia64
atl21asm.lib 684KB
atl.lib 15KB
atlsd.lib 2.76MB
atls.lib 2.19MB
amd64
atl.lib 12KB
atlthunk.lib 426KB
atlsd.lib 2.42MB
atls.lib 2.03MB
i386
atl.lib 13KB
atlthunk.lib 121KB
atlsd.lib 2.95MB
atls.lib 2.61MB
共 54 条
- 1
资源评论
- farie2016-07-06不错,是好东西。
- cwwg1232013-06-05已经能用了!!
- shawnchenchen2014-04-02谢谢,帮了我的忙,终于用起来了
老邓
- 粉丝: 1014
- 资源: 31
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功