So I'm developing an app that uses the desktop duplication API, however, when using the IDXGIDevice
interface and trying to access its getParent
method I get the following error
class "IDXGIDevice" has no member "GetParent"
When using header files and the scope resolution operator like this
DDAPI.h
#include <d3d11.h>
#include <dxgi1_2.h>
class DDAPI
{
public:
HRESULT InitDDA();
private:
ID3D11Device* m_Device;
}
DDAPI.cpp
HRESULT DDAPI::InitDDA()
{
IDXGIDevice* pDevice = nullptr;
IDXGIAdapter* pAdapter = nullptr;
m_Device->QueryInterface(__uuidof(IDXGIDevice), (void**)&pDevice);
pDevice->GetParent(__uuidof(IDXGIAdapter), (void**)&pAdapter); // Errors Here
}
(I have already initialised ID3D11Device m_Device)
However If I was to create the class within the DDAPI.cpp file like this, it works and does not give me an error
class DDAPI
{
ID3D11Device* m_Device;
HRESULT InitDDA()
{
IDXGIDevice* pDevice = nullptr;
IDXGIAdapter* pAdapter = nullptr;
m_Device->QueryInterface(__uuidof(IDXGIDevice), (void**)&pDevice);
pDevice->GetParent(__uuidof(IDXGIAdapter), (void**)&pAdapter);
}
};
In the first example, IntelliSense does not show all the other methods that IDXGIDevice
has (Just contains the base IUnknown interface methods) but it does in the 2nd example
This might just be an IntelliSense error, as there are no build errors, but if it's showing up as an error, I'm assuming it means I can do this another way