提问人:46784 提问时间:7/25/2023 最后编辑:Simon Mourier46784 更新时间:7/25/2023 访问量:41
DuplicateOutput 随E_INVALIDARGS下降
DuplicateOutput is falling with E_INVALIDARGS
问:
我正在尝试捕获我的屏幕,并且也这样做,我正在使用重复输出(行:44),但它失败了,并出现错误E_INVALIDARGS。这是我第一次使用directx。
#include "dda_impl.hpp"
#include "definitions.hpp"
HRESULT dda_impl::initialize( )
{
IDXGIOutput* output{ nullptr };
IDXGIDevice2* device{ nullptr };
IDXGIFactory1* factory{ nullptr };
IDXGIAdapter* adapter{ nullptr };
IDXGIOutput1* output1{ nullptr };
/// Release all temporary refs before exit
#define CLEAN_RETURN( x ) \
SAFE_RELEASE( device );\
SAFE_RELEASE( factory );\
SAFE_RELEASE( output );\
SAFE_RELEASE( output1 );\
SAFE_RELEASE( adapter );\
return x;
HRESULT hr{ S_OK };
/// To create a DDA object given a D3D11 device, we must first get to the DXGI Adapter associated with that device
if ( FAILED( hr = this->m_d3d_device->QueryInterface( __uuidof( IDXGIDevice2 ), ( void** ) &device ) ) )
{
CLEAN_RETURN( hr );
}
if ( FAILED( hr = device->GetParent( __uuidof( IDXGIAdapter ), ( void** ) &adapter ) ) )
{
CLEAN_RETURN( hr );
}
/// Once we have the DXGI Adapter, we enumerate the attached display outputs, and select which one we want to capture
/// This sample application always captures the primary display output, enumerated at index 0.
if ( FAILED ( hr = adapter->EnumOutputs( 0, &output ) ) )
{
CLEAN_RETURN( hr );
}
if ( FAILED( hr = output->QueryInterface( __uuidof( IDXGIOutput1 ), ( void** ) &output1 ) ) )
{
CLEAN_RETURN( hr );
}
/// Ask DXGI to create an instance of IDXGIOutputDuplication for the selected output. We can now capture this display output
if ( FAILED( hr = output1->DuplicateOutput( device, &this->m_duplication ) ) )
{
CLEAN_RETURN( hr );
}
尝试使用 directx 调试工具,但每当安装 directx sdk 时,我都会收到 d3d11.h 的未解析外部符号。我不确定我是否设置了错误的设备或我做错了什么。
答: 暂无答案
评论