Information
The topic you requested is included in another documentation set. For convenience, it's displayed below. Choose Switch to see the topic in its original location.

ComPtr::As Method

Returns a ComPtr object that represents the interface identified by the specified template parameter.

template<
   typename U
>
HRESULT As(
   _Out_ ComPtr<U>* p
) const;

template<
   typename U
>
HRESULT As(
   _Out_ Details::ComPtrRef<ComPtr<U>> p
) const;

U

The interface to be represented by parameter p.

p

A ComPtr object that represents the interface specified by parameter U. Parameter p must not refer to the current ComPtr object.

The first template is the form that you should use in your code. The second template is an internal, helper specialization that supports C++ language features such as the auto type deduction keyword.

S_OK if successful; otherwise, an HRESULT that indicates the error.

Header: client.h

Namespace: Microsoft::WRL

Show:
© 2014 Microsoft