与Win32

编程入门 行业动态 更新时间:2024-10-21 11:30:49
本文介绍了与Win32_PnPEntity和Win32_DiskDrive相关的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

存在,我有一个查询来检测USB设备. ---------------------------- SELECT * FROM __InstanceOperationEvent在1个位置内TargetInstance ISA'Win32_PnPEntity'和TargetInstance.Service ='USBSTOR' -------------------------- - 我从中获得USB的PnPDevice ID.现在,我还需要它的驱动器名称或磁盘号,它是Win32_DiskDrive的详细信息.我想知道USB显示为哪个名称(D:/E:..).主要是,我认为我的问题与Win32_PnPEntity和Win32_DiskDrive有关.对于相同的USB,在两种情况下显示的PnPDeviceID均不同. 注意:可以连接2个以上的USB,因此我无法判断是Win32_DiskDrive中的USB驱动器. ="h2_lin">解决方案

您好,Vipink85, 基于我的理解,您可以使用 GetDrivers 方法,该方法在" System :: IO :: DriverInfo "检索计算机上所有逻辑驱动器的驱动器名称.有关更多信息,请参见带有以下链接的该线程: social.msdn.microsoft/forums/en-US/vcgeneral/thread/f632190f-b77b-4646-8a18-e63c7b7425c0 如果我误解了您,或者您有任何问题,请告诉我. 最好的问候,南希

Presenlty, I have a query to detect USB device. ---------------------------- SELECT * FROM __InstanceOperationEvent WITHIN 1 WHERE TargetInstance ISA 'Win32_PnPEntity' and TargetInstance.Service='USBSTOR' ---------------------------- I get USB's PnPDevice ID from it. Now I also want its drive name or disk number which is a Win32_DiskDrive detail. I wanted to know the USB is displayed as which name(D:/E:..). Mainly, I think my problem is relating Win32_PnPEntity and Win32_DiskDrive. The PnPDeviceID displayed in both the cases are different for same USB. Note: There can be more than 2 USB's attached so I cannot juct check which is USB drive from Win32_DiskDrive.

解决方案

Hi Vipink85,Based on my understanding, you could use GetDrivers method which defined in "System::IO::DriverInfo" to retrieves the drive names of all logical drives on a computer. For more information, please see this thread with following link:social.msdn.microsoft/forums/en-US/vcgeneral/thread/f632190f-b77b-4646-8a18-e63c7b7425c0If I misunderstood you, or you have any problems, please let me know.Best Regards,Nancy

更多推荐

与Win32

本文发布于:2023-11-06 06:45:43,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1562973.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!