无法获取对 IPart 的引用
例如,我试图获取对 IPart 接口的引用来控制 Windows 音频音量级别,并且我使用 IDeviceTopology::GetPartById
函数来获取它。
该函数采用 UINT。我尝试了 0 但什么也没得到,然后放弃并尝试增加 UINT 直到我可以获得引用。那样的话就不走运了。
我已经获得了正确设备拓扑的参考。
我的 HRESULT 是 E_INVALIDARG
。
难道只是我的设备上没有可用的部件吗?
MSDN 说要获取一个 ID传入 GetPartById,我应该调用 IAudioInputSelector::GetSelection
。不过,要使用 IAudioInputSelector,我需要已经拥有对 IPart 对象的引用。
I'm trying to get a reference to the IPart interface to control Windows audio volume level, for example, and I'm using the IDeviceTopology::GetPartById
function to get it.
This function takes a UINT. I tried 0 and got nothing, then gave in and just tried incrementing a UINT until I could get a reference. No luck that way.
I've got a reference to the correct device topology.
My HRESULT is E_INVALIDARG
.
Is it just the case that there aren't any parts available on my device?
MSDN says to get an ID to pass into GetPartById, I should call IAudioInputSelector::GetSelection
. To use IAudioInputSelector though, I need to already have a reference to an IPart object.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
最简单的方法是枚举主机引脚并从所需的输入到所需的输出调用 GetSignalPath,这将返回部件的集合。
或者,如果您有拓扑对象,则可以调用 GetSubunit 或 GetConnector 来检索子单元或连接器(它们也是部件)。从每个连接器,您可以调用 GetConnectedTo(),它将返回连接器另一侧的部件。继续,您将能够遍历整个拓扑图并识别所有部分。
The easiest way is to enumerate the host pins and call GetSignalPath from the desired input to the desired output, that will return you a collection of parts.
Alternatively, if you have a topology object, you can call GetSubunit or GetConnector to retrieve the subunits or connectors (which are also parts). From each connector, you can call GetConnectedTo() which will return the part on the other side of the connector. Continue and you'll be able to walk the entire topology graph and identify all the parts.