ComPtrpDevice; HRESULT result = D3D11CreateDevice(nullptr, D3D_DRIVER_TYPE_HARDWARE, nullptr, 0, nullptr, 0, D3D11_SDK_VERSION, &pDevice.Get(), nullptr, nullptr); if (FAILED(result)) { // handle error } // use the pDevice here
ComPtrIn this example, the Get method is used to get the pointer to the IMessageFilter interface from the ComPtr smart pointer after creating it using the MyMessageFilter class. This is a part of the Windows API library which is included in the Windows SDK.spFilter = new MyMessageFilter(); HRESULT result = ::CoRegisterMessageFilter(spFilter.Get(), nullptr); if (FAILED(result)) { // handle error } // use the spFilter here