小编mar*_*pic的帖子

从子 COM 对象获取父 COM 对象

ID3D12GraphicsCommandList接口由继承ID3D12CommandList。那么,如果我有一个ID3D12GraphicsCommandList对象,我如何获得相应的ID3D12CommandList对象?

  1. 排版会起作用吗?
    ID3D12GraphicsCommandList *gcl = ...;
    ID3D12CommandList *cl = (ID3D12CommandList*)gcl;
Run Code Online (Sandbox Code Playgroud)
  1. QueryInterface 会工作吗?
    ID3D12GraphicsCommandList *gcl = ...;
    ID3D12CommandList *cl;
    HRESULT result = ID3D12GraphicsCommandList_QueryInterface(gcl,
                                                              &IID_ID3D12CommandList,
                                                              (void**)&cl);
Run Code Online (Sandbox Code Playgroud)
  1. 我需要做其他事情吗?

谢谢。

c com directx winapi direct3d12

1
推荐指数
1
解决办法
269
查看次数

标签 统计

c ×1

com ×1

direct3d12 ×1

directx ×1

winapi ×1