在 Windows XP 上检索详细的 USB MIDI 设备信息

发布于 2024-10-09 18:23:06 字数 395 浏览 0 评论 0原文

函数 midiOutGetDevCaps 返回结构 MIDIOUTCAPS 。 在 Windows XP 上查询 USB Midi 设备时,我需要更具体的信息,特别是在使用设备管理器打开相应设备时,我需要“位置”下显示的信息。 我需要此信息以便以编程方式区分连接到计算机的多个 MIDI 接口。使用 midiOutGetDevCaps,我统一为连接到计算机的每个 midi usb 接口获取“USB 音频设备”,因此无法区分接口。 更糟糕的是,该字符串是本地化的,因此例如在德语 Windows 上,您将得到“USB Audiogerät”而不是“USB Audio Device”。

The function midiOutGetDevCaps returns a structure MIDIOUTCAPS.
I'd need more specific information when querying a usb midi device on windows xp, in particular I'd need the information displayed under "Location" when opening the respective device using the Device Manager.
I need this information in order to programmatically distinguish between several MIDI Interfaces connected to a computer. Using midiOutGetDevCaps, I uniformly get "USB Audio Device" for every midi usb interface connected to the computer, so distinguishing between the interfaces is impossible.
To make matters worse, this string is localized, so e.g. on a German Windows you'll get "USB Audiogerät" instead of "USB Audio Device".

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

忘羡 2024-10-16 18:23:06

我想这取决于你有多绝望。我自己也曾使用过 USB 设备。就我而言,我需要枚举某些 USB COM 端口相关设备。 。 。无论它们当前是否连接到系统。

这些都是公司专有代码,抱歉我无法发布它,但是对有关 USB 相关设备的所有信息的搜索从这里开始(Perl):

$hostnamePrefix = "//$hostname/";
my $baseKey = "${hostnamePrefix}HKEY_LOCAL_MACHINE/System/CurrentControlSet/";
my $regVidList = Win32::TieRegistry->new("${baseKey}Enum/USB/", $optionsRef);

如果我没记错的话,这是一个相当简单的结构。我相信您实际上必须循环访问注册表的两个单独部分才能获得您需要的一切。 。 。如果您非常渴望尝试此操作,我很乐意尽可能回答问题,但发布代码需要获得我们法律部门的批准。 (并非不可能,但需要数周时间才能获得。)

此外,虽然这适用于 XP 。 。 。不知道win7下怎么用。 (我不知道哪种方式,据我所知,还没有人尝试过。)

编码这并没有那么糟糕(结果 Perl 脚本大约有 1000 行代码,几乎 50% 是注释),但是计算出所有钥匙和特殊情况之间的关系需要几天的时间。

I guess it depends on how desperate you are. I've had my own run in with USB devices. In my case I needed to enumerate certain USB COM port related devices . . . regardless if they are currently attached to the system or not.

It is all company proprietary code, sorry I cannot post it, but the search for all information regarding USB related devices starts here (Perl):

$hostnamePrefix = "//$hostname/";
my $baseKey = "${hostnamePrefix}HKEY_LOCAL_MACHINE/System/CurrentControlSet/";
my $regVidList = Win32::TieRegistry->new("${baseKey}Enum/USB/", $optionsRef);

If memory serves me it is a reasonably straight forward structure. I believe you actually have to loop through two separate sections of the registry to get everything you need . . . if you are desperate enough to attempt this, I'm happy to answer questions where I can, but posting code would required approval from our legal department. (Not impossible, but it would take weeks to obtain.)

Also, while this will work on XP . . . I have no idea how it will work on Win7. (I don't know either way, nobody has tried it yet that I am aware of.)

Coding this was not that bad (resulting Perl Script is around 1000 lines of code which is almost 50% comments), but working out all the relationships between the keys and the special cases took several days.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文