_com_ptr_t::_com_ptr_t
Microsoft 전용
_com_ptr_t 개체를 생성합니다.
구문
// Default constructor.
// Constructs a NULL smart pointer.
_com_ptr_t() throw();
// Constructs a NULL smart pointer. The NULL argument must be zero.
_com_ptr_t(
int null
);
// Constructs a smart pointer as a copy of another instance of the
// same smart pointer. AddRef is called to increment the reference
// count for the encapsulated interface pointer.
_com_ptr_t(
const _com_ptr_t& cp
) throw();
// Move constructor (Visual Studio 2015 Update 3 and later)
_com_ptr_t(_com_ptr_t&& cp) throw();
// Constructs a smart pointer from a raw interface pointer of this
// smart pointer's type. If fAddRef is true, AddRef is called
// to increment the reference count for the encapsulated
// interface pointer. If fAddRef is false, this constructor
// takes ownership of the raw interface pointer without calling AddRef.
_com_ptr_t(
Interface* pInterface,
bool fAddRef
) throw();
// Construct pointer for a _variant_t object.
// Constructs a smart pointer from a _variant_t object. The
// encapsulated VARIANT must be of type VT_DISPATCH or VT_UNKNOWN, or
// it can be converted into one of these two types. If QueryInterface
// fails with an E_NOINTERFACE error, a NULL smart pointer is
// constructed.
_com_ptr_t(
const _variant_t& varSrc
);
// Constructs a smart pointer given the CLSID of a coclass. This
// function calls CoCreateInstance, by the member function
// CreateInstance, to create a new COM object and then queries for
// this smart pointer's interface type. If QueryInterface fails with
// an E_NOINTERFACE error, a NULL smart pointer is constructed.
explicit _com_ptr_t(
const CLSID& clsid,
IUnknown* pOuter = NULL,
DWORD dwClsContext = CLSCTX_ALL
);
// Calls CoCreateClass with provided CLSID retrieved from string.
explicit _com_ptr_t(
LPCWSTR str,
IUnknown* pOuter = NULL,
DWORD dwClsContext = CLSCTX_ALL
);
// Constructs a smart pointer given a multibyte character string that
// holds either a CLSID (starting with "{") or a ProgID. This function
// calls CoCreateInstance, by the member function CreateInstance, to
// create a new COM object and then queries for this smart pointer's
// interface type. If QueryInterface fails with an E_NOINTERFACE error,
// a NULL smart pointer is constructed.
explicit _com_ptr_t(
LPCSTR str,
IUnknown* pOuter = NULL,
DWORD dwClsContext = CLSCTX_ALL
);
// Saves the interface.
template<>
_com_ptr_t(
Interface* pInterface
) throw();
// Make sure correct ctor is called
template<>
_com_ptr_t(
LPSTR str
);
// Make sure correct ctor is called
template<>
_com_ptr_t(
LPWSTR str
);
// Constructs a smart pointer from a different smart pointer type or
// from a different raw interface pointer. QueryInterface is called to
// find an interface pointer of this smart pointer's type. If
// QueryInterface fails with an E_NOINTERFACE error, a NULL smart
// pointer is constructed.
template<typename _OtherIID>
_com_ptr_t(
const _com_ptr_t<_OtherIID>& p
);
// Constructs a smart-pointer from any IUnknown-based interface pointer.
template<typename _InterfaceType>
_com_ptr_t(
_InterfaceType* p
);
// Disable conversion using _com_ptr_t* specialization of
// template<typename _InterfaceType> _com_ptr_t(_InterfaceType* p)
template<>
explicit _com_ptr_t(
_com_ptr_t* p
);
매개 변수
pInterface
원시 인터페이스 포인터입니다.
fAddRef
AddRef
이면 true
캡슐화된 인터페이스 포인터의 참조 수를 증분하기 위해 호출됩니다.
Cp
_com_ptr_t 개체입니다.
p
원시 인터페이스 포인터로, 해당 형식이 이 _com_ptr_t 개체의 스마트 포인터 형식과 다릅니다.
varSrc
_variant_t
개체입니다.
clsid
CLSID
coclass의
dwClsContext
실행 코드를 실행하는 컨텍스트입니다.
lpcStr
("{"로 시작) 또는 .을 포함하는 CLSID
멀티바이트 문자열입니다ProgID
.
pOuter
집계에 대해 알 수 없는 외부입니다.
Microsoft 전용 종료
참고 항목
피드백
https://aka.ms/ContentUserFeedback
출시 예정: 2024년 내내 콘텐츠에 대한 피드백 메커니즘으로 GitHub 문제를 단계적으로 폐지하고 이를 새로운 피드백 시스템으로 바꿀 예정입니다. 자세한 내용은 다음을 참조하세요.다음에 대한 사용자 의견 제출 및 보기