怎么通过设备句柄根据pid获取窗口句柄设备的vid pid

当前位置:
&&&获取设备的PID与VID的方法
获取设备的PID与VID的方法
下面小编来为大家讲讲获取设备的PID与VID的方法,方法很简单,看了便知:
获取方法:
1.鼠标右键点击&计算机&(win xp中是&我的电脑&),选择&管理&(或设备管理器)
2.连接手机设备,在设备的一栏点击鼠标右键,选择属性
3.选择详细信息,选中任意一项右键,并选择复制。粘贴至文本文档或其他便于记录的地方即可
注意:win xp中不能直接复制该项,此时请对照找到的PID和VID,手动输出
小编点评:以上就是获取设备的PID与VID的方法,希望可以帮助大家顺利解决问题!
更多内容请扫描下方二维码关注亿智蘑菇微信公众号
126人申请【婴萌智能冲奶机Milking Pro】
816人申请【352 X80空气净化器】
2063人申请【阿里智能RSR DS909苹果WIFI音响】
809人申请【EN700铜雀耳机】
986人申请【飞智wee拉伸手柄】
¥299【镭拓MXX】为啥你成不了大神?因为你没有它!
¥1299【AIRFAERIE】战斗吧!孩子身边的健康护卫
¥599【华为P8】考场弊事,小纸条太低端
¥108【贝壳】藏在贝壳里的秘密
¥238【日本cheero】惊呆!一个旧纸箱居然......
你还可以分享到以下地方,获得10蘑菇参与!
微信添加"亿智蘑菇"获取我们的服务
微博添加"亿智蘑菇"获取我们的服务
下次自动登录
微信扫一扫 立即登录功能实现(26)
1,添加头文件和宏定义
#include&&setupapi.h& &&#include&&initguid.h& &&#pragma&comment(lib,&setupapi.lib&)&&&&DEFINE_GUID&(UsbClassGuid,&0xa5dcbf10L,&0xd2,&0x90,&0x1f,&0x00,&0xc0,&0x4f,&0xb9,&0x51,&0xed);&&
#include &setupapi.h&
#include &initguid.h&
#pragma comment(lib,&setupapi.lib&)
DEFINE_GUID (UsbClassGuid, 0xa5dcbf10L, 0xd2, 0x90, 0x1f, 0x00, 0xc0, 0x4f, 0xb9, 0x51, 0xed);
HDEVINFO&hDevI&&SP_DEVICE_INTERFACE_DATA&spDevD&&PSP_DEVICE_INTERFACE_DETAIL_DATA&pD&&BOOL&bRes&=&TRUE;&&int&nCount&=&0;&&hDevInfo&=&::SetupDiGetClassDevs((LPGUID)&UsbClassGuid,NULL,NULL,DIGCF_PRESENT|DIGCF_INTERFACEDEVICE);&&if&(hDevInfo&!=&INVALID_HANDLE_VALUE)&&{&&&&&&pDetail&=&(PSP_DEVICE_INTERFACE_DETAIL_DATA)::GlobalAlloc(LMEM_ZEROINIT,1024);&&&&&&pDetail-&cbSize&=&sizeof(SP_DEVICE_INTERFACE_DETAIL_DATA);&&&&&&while&(bRes)&&&&&&{&&&&&&&&&&&&&&&&&&&&&spDevData.cbSize&=&sizeof(SP_DEVICE_INTERFACE_DATA);&&&&&&&&&&bRes&=&::SetupDiEnumDeviceInterfaces(hDevInfo,NULL,(LPGUID)&UsbClassGuid,nCount,&spDevData);&&&&&&&&&&if&(bRes)&&&&&&&&&&{&&&&&&&&&&&&&&bRes&=&::SetupDiGetInterfaceDeviceDetail(hDevInfo,&spDevData,pDetail,1024,NULL,NULL);&&&&&&&&&&&&&&if&(bRes)&&&&&&&&&&&&&&{&&&&&&&&&&&&&&&&&&CString&szStr&=&pDetail-&DeviceP&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&nCount&++;&&&&&&&&&&&&&&}&&&&&&&&&&}&&&&&&}&&&&&&::GlobalFree(pDetail);&&&&&&::SetupDiDestroyDeviceInfoList(hDevInfo);&&}&&
HDEVINFO hDevI
SP_DEVICE_INTERFACE_DATA spDevD
PSP_DEVICE_INTERFACE_DETAIL_DATA pD
BOOL bRes = TRUE;
int nCount = 0;
hDevInfo = ::SetupDiGetClassDevs((LPGUID)&UsbClassGuid,NULL,NULL,DIGCF_PRESENT|DIGCF_INTERFACEDEVICE);
if (hDevInfo != INVALID_HANDLE_VALUE)
pDetail = (PSP_DEVICE_INTERFACE_DETAIL_DATA)::GlobalAlloc(LMEM_ZEROINIT,1024);
pDetail-&cbSize = sizeof(SP_DEVICE_INTERFACE_DETAIL_DATA);
while (bRes)
spDevData.cbSize = sizeof(SP_DEVICE_INTERFACE_DATA);
bRes = ::SetupDiEnumDeviceInterfaces(hDevInfo,NULL,(LPGUID)&UsbClassGuid,nCount,&spDevData);
bRes = ::SetupDiGetInterfaceDeviceDetail(hDevInfo,&spDevData,pDetail,1024,NULL,NULL);
CString szStr = pDetail-&DeviceP
nCount ++;
::GlobalFree(pDetail);
::SetupDiDestroyDeviceInfoList(hDevInfo);
pDetail-&DevicePath = 0x00224f04 &}&
参考知识库
* 以上用户言论只代表其个人观点,不代表CSDN网站的观点或立场
访问:80862次
积分:1143
积分:1143
排名:千里之外
原创:14篇
转载:109篇
(1)(1)(1)(1)(1)(2)(2)(1)(6)(3)(2)(5)(6)(8)(27)(20)(23)(8)(1)(3)(1)博客访问: 710880
博文数量: 256
博客积分: 1760
博客等级: 上尉
技术积分: 1597
注册时间:
APP发帖 享双倍积分
IT168企业级官微
微信号:IT168qiye
系统架构师大会
微信号:SACC2013
分类: WINDOWS
//------------------------------------------------------------------->#include #include #include #include #include #include #include #include #include #pragma comment (lib, "Setupapi.lib")///////////////////////////////////////////////////////////////////////////////////////void SearchUDISK(GUID *pGUID){&&& int nCount,len,i;/*标记同一设备个数*/&&& HDEVINFO hDevInfoS&&& BOOL bR&&& char *&&& char volume[MAX_PATH];&&& char ch[MAX_PATH];&&& memset(volume, 0, MAX_PATH);&&& PSP_DEVICE_INTERFACE_DETAIL_DATA&& pDetail&& =NULL;&&& /*取得一个该GUID相关的设备信息集句柄*/&&& hDevInfoSet = SetupDiGetClassDevs(pGUID,/*GUID_CLASS_USB_DEVICE, class&& GUID*/&&&&&&& NULL,&& /*无关键字*/&&&&&&& NULL,&& /*不指定父窗口句柄*/&&&&&&& DIGCF_PRESENT | DIGCF_DEVICEINTERFACE);&& /*目前存在的设备*/&&& /*失败...*/&&& if(hDevInfoSet == INVALID_HANDLE_VALUE)&&& {&&&&&&&&&& }&&& /*申请设备接口数据空间*/&&& nCount = 0;&&& bResult = TRUE;&&& SP_DEVICE_INTERFACE_DATA&&&&& /*设备序号=0,1,2...&& 逐一测试设备接口,到失败为止*/&&& while(bResult)&&& {&&&&&&& ifdata.cbSize = sizeof(ifdata);&&&&&&& /*枚举符合该GUID的设备接口*/&&&&&&& bResult = SetupDiEnumDeviceInterfaces(&&&&&&&&&&& hDevInfoSet,&& /*设备信息集句柄*/&&&&&&&&&&& NULL,&& /*不需额外的设备描述*/&&&&&&&&&&& pGUID,/*GUID_CLASS_USB_DEVICE,&&&& GUID*/&&&&&&&&&&& (ULONG)nCount,&& /*设备信息集里的设备序号*/&&&&&&&&&&& &ifdata);&& /*设备接口信息*/&&&&&&& if(bResult)&&&&&&& {&&&&&&&&&&& ULONG predictedLength = 0;&&&&&&&&&&& ULONG requiredLength = 0;&&&&&&&&&&& //&& 取得该设备接口的细节(设备路径)&&&&&&&&&&& bResult = SetupDiGetInterfaceDeviceDetail(&&&&&&&&&&&&&&& hDevInfoSet,&& /*设备信息集句柄*/&&&&&&&&&&&&&&& &ifdata,&& /*设备接口信息*/&&&&&&&&&&&&&&& NULL,&& /*设备接口细节(设备路径)*/&&&&&&&&&&&&&&& 0,&& /*输出缓冲区大小*/&&&&&&&&&&&&&&& &requiredLength,&& /*不需计算输出缓冲区大小(直接用设定值)*/&&&&&&&&&&&&&&& NULL);&& /*不需额外的设备描述*/&&&&&&&&&&& /*&& 取得该设备接口的细节(设备路径)*/&&&&&&&&&&& predictedLength=requiredL&&&&&&&&&&& pDetail = (PSP_INTERFACE_DEVICE_DETAIL_DATA)GlobalAlloc(LMEM_ZEROINIT,&& predictedLength);&&&&&&&&&&& pDetail->cbSize = sizeof(SP_DEVICE_INTERFACE_DETAIL_DATA);&&&&&&&&&&& bResult = SetupDiGetInterfaceDeviceDetail(&&&&&&&&&&&&&&& hDevInfoSet,&& /*设备信息集句柄*/&&&&&&&&&&&&&&& &ifdata,&& /*设备接口信息*/&&&&&&&&&&&&&&& pDetail,&& /*设备接口细节(设备路径)*/&&&&&&&&&&&&&&& predictedLength,&& /*输出缓冲区大小*/&&&&&&&&&&&&&&& &requiredLength,&& /*不需计算输出缓冲区大小(直接用设定值)*/&&&&&&&&&&&&&&& NULL);&& /*不需额外的设备描述*/&&&&&&&&&&& if(bResult)&&&&&&&&&&& {&&&&&&&&&&&&&&& memset(ch, 0, MAX_PATH);&&&&&&&&&&&&&&& /*复制设备路径到输出缓冲区*/&&&&&&&&&&&&&&& for(i=0; i<requiredL i++)&&&&&&&&&&&&&&& {&&&&&&&&&&&&&&&&&&& ch[i]=*(pDetail->DevicePath+8+i);&&&&&&&&&&&&&&& }&&&&&&&&&&&&&&& printf("%s\r\n", ch);&&&&&&&&&&&&&&& ch[17]= '\0';&&&&&&&&&&&&&&& if(strcmp(ch,"vid_2008&pid_763a")==0)&&&&&&&&&&&&&&& {&&&&&&&&&&&&&&&&&&& printf("as60x burncode is readly!\r\n");&&&&&&&&&&&&&&& }&&&&&&&&&&& }&&&&&&& }&&&&&&& nCount++;&&& }&&& /*释放设备接口数据空间*/&&& GlobalFree(pDetail);&&& /*关闭设备信息集句柄*/&&& SetupDiDestroyDeviceInfoList(hDevInfoSet);}DEFINE_GUID(GUID_DEVINTERFACE_DISK,&&&&&&&&&&&&&&&&&& 0x53f56307L, 0xb6bf, 0x11d0, 0x94, 0xf2, 0x00, 0xa0, 0xc9, 0x1e, 0xfb, 0x8b);DEFINE_GUID(GUID_DEVINTERFACE_CDROM,&&&&&&&&&&&&&&&&& 0x53f56308L, 0xb6bf, 0x11d0, 0x94, 0xf2, 0x00, 0xa0, 0xc9, 0x1e, 0xfb, 0x8b);DEFINE_GUID(GUID_DEVINTERFACE_PARTITION,&&&&&&&&&&&&& 0x53f5630aL, 0xb6bf, 0x11d0, 0x94, 0xf2, 0x00, 0xa0, 0xc9, 0x1e, 0xfb, 0x8b);DEFINE_GUID(GUID_DEVINTERFACE_TAPE,&&&&&&&&&&&&&&&&&& 0x53f5630bL, 0xb6bf, 0x11d0, 0x94, 0xf2, 0x00, 0xa0, 0xc9, 0x1e, 0xfb, 0x8b);DEFINE_GUID(GUID_DEVINTERFACE_WRITEONCEDISK,&&&&&&&&& 0x53f5630cL, 0xb6bf, 0x11d0, 0x94, 0xf2, 0x00, 0xa0, 0xc9, 0x1e, 0xfb, 0x8b);DEFINE_GUID(GUID_DEVINTERFACE_VOLUME,&&&&&&&&&&&&&&&& 0x53f5630dL, 0xb6bf, 0x11d0, 0x94, 0xf2, 0x00, 0xa0, 0xc9, 0x1e, 0xfb, 0x8b);DEFINE_GUID(GUID_DEVINTERFACE_MEDIUMCHANGER,&&&&&&&&& 0x53f56310L, 0xb6bf, 0x11d0, 0x94, 0xf2, 0x00, 0xa0, 0xc9, 0x1e, 0xfb, 0x8b);DEFINE_GUID(GUID_DEVINTERFACE_FLOPPY,&&&&&&&&&&&&&&&& 0x53f56311L, 0xb6bf, 0x11d0, 0x94, 0xf2, 0x00, 0xa0, 0xc9, 0x1e, 0xfb, 0x8b);DEFINE_GUID(GUID_DEVINTERFACE_CDCHANGER,&&&&&&&&&&&&& 0x53f56312L, 0xb6bf, 0x11d0, 0x94, 0xf2, 0x00, 0xa0, 0xc9, 0x1e, 0xfb, 0x8b);DEFINE_GUID(GUID_DEVINTERFACE_STORAGEPORT,&&&&&&&&&&& 0x2accfe60L, 0xc130, 0x11d2, 0xb0, 0x82, 0x00, 0xa0, 0xc9, 0x1e, 0xfb, 0x8b);DEFINE_GUID(GUID_INTERFACE_SILABS_BULK,&&&&&&&&&&&&&& 0x76228c66L, 0xd3, 0x96, 0x32, 0xeb, 0xad, 0x0a, 0x23, 0x0d, 0x13);DEFINE_GUID(GUID_DEVINTERFACE_USBMASSSTORAGEDEVICE,&& 0xa5dcbf10L, 0xd2, 0x90, 0x1f, 0x00, 0xc0, 0x4f, 0xb9, 0x51, 0xed);int main(){&&& GUID uguid[] =&&& {&&&&&&& GUID_DEVINTERFACE_DISK,&&&&&&& GUID_DEVINTERFACE_CDROM,&&&&&&& GUID_DEVINTERFACE_PARTITION,&&&&&&& GUID_DEVINTERFACE_TAPE,&&&&&&& GUID_DEVINTERFACE_WRITEONCEDISK,&&&&&&& GUID_DEVINTERFACE_VOLUME,&&&&&&& GUID_DEVINTERFACE_MEDIUMCHANGER,&&&&&&& GUID_DEVINTERFACE_FLOPPY,&&&&&&& GUID_DEVINTERFACE_CDCHANGER,&&&&&&& GUID_DEVINTERFACE_STORAGEPORT,&&&&&&& GUID_INTERFACE_SILABS_BULK,&&&&&&& GUID_DEVINTERFACE_USBMASSSTORAGEDEVICE&&& };&&& int i = 0;&&& for(i=0; i<sizeof(uguid); i++)&&&&&&& SearchUDISK(&uguid[i]);&&& return 1;}//-------------------------------------------------------------------<VS2008编译通过//////////////////////////////////////////////////////////////////////////////////////////大多数GUID信息//------------------------------------------------------------------->在USB编程之前要事先了解一下GUID的概念。应用其他网页中的定义:全球唯一标识符 (GUID) 是一个字母数字标识符,用于指示产品的唯一性安装。在许多流行软件应用程序(例如 Web 浏览器和媒体播放器)中,都使用 GUID。GUID 的格式为“xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx”,其中每个 x 是 0-9 或 a-f 范围内的一个十六进制的数字。例如:6F9619FF-8B86-D011-B42D-00C04FC964FF 即为有效的 GUID 值。在计算机领域有很多东西需要不重复的唯一标识的东西,例如设备的类型,类,接口标识,目录名等等。这是个天文数字,我记得是有工具能自动生成这个GUID 码的,反正不同地点,不同时间,生成相同的GUID的可能性很小很小很小,小到什么程度,没查过,基本上可以认为是不可能生成相同的GUID值的。计算机中有各种个样的设备类型,这些设备类型被微软用固定的GUID来标识了,这些GUID对实际编程是有很大关系的,用错了会麻烦,我查了一下文档,把查到的设备类型的GUID列在下面供大家参考:1394 Host Bus ControllerClass = 1394ClassGuid = {6bdd1fc1-810f-11d0-bec7-0f}This class includes system-supplied drivers of 1394 host controllers connected on a PCI bus, but not drivers of 1394 peripherals.Battery DevicesClass = BatteryClassGuid = {a4-11d0-bcf7-00aa00b7b32a}This class includes drivers of battery devices and UPSes.CD-ROM DrivesClass = CDROMClassGuid = {4d36e965-e325-11ce-bfc1-0}This class includes drivers of CD-ROM drives, including SCSI CD-ROM drives. By default, the system's CD-ROM class installer also installs a system-supplied CD audio driver and CD-ROM changer driver as PnP filters.Disk DrivesClass = DiskDriveClassGuid = {4d36e967-e325-11ce-bfc1-0}This class includes drivers of hard disk drives. See also the HDC and SCSIAdapter classes.Display AdaptersClass = DisplayClassGuid = {4d36e968-e325-11ce-bfc1-0}This class includes drivers of video adapters, including display drivers and video miniports.Floppy Disk ControllersClass = FDCClassGuid = {4d36e969-e325-11ce-bfc1-0}This class includes drivers of floppy disk drive controllers.Floppy Disk DrivesClass= FloppyDiskClassGuid= {4d36e980-e325-11ce-bfc1-0}This class includes drivers of floppy drives.Hard Disk ControllersClass = HDCClassGuid = {4d36e96a-e325-11ce-bfc1-0}This class includes drivers of hard disk controllers, including ATA/ATAPI controllers but not SCSI and RAID disk controllers.Human Input Devices (HID)Class = HIDClassClassGuid = {745a17a0-74d3-11d0-b6fe-00a0c90f57da}This class includes devices that export interfaces of the HID class, including HID keyboard and mouse devices, which the installed HID device drivers enumerate as their respective "child" devices. (See also the Keyboard or Mouse classes later in this list.)Imaging DeviceClass = ImageClassGuid = {6bdd1fc6-810f-11d0-bec7-0f}This class includes drivers of still-image capture devices, digital cameras, and scanners.IrDA DevicesClass = InfraredClassGuid = {6bdd1fc5-810f-11d0-bec7-0f}This class includes Serial-IR and Fast-IR NDIS miniports, but see also the Network Adapter class for other NDIS NIC miniports.KeyboardClass = KeyboardClassGuid = {4d36e96b-e325-11ce-bfc1-0}This class includes all keyboards. That is, it also must be specified in the (secondary) INF for an enumerated "child" HID keyboard device.Medium ChangersClass= MediumChangerClassGuid= {ce5939ae-ebde-11d0-b181-ec4}This class includes drivers of SCSI media changer devices.Memory Technology DriverClass = MTDClassGUID = {4d36e970-e325-11ce-bfc1-0}This class includes drivers for memory devices, such as flash memory cards.MultimediaClass = MediaClassGuid = {4d36e96c-e325-11ce-bfc1-0}This class includes Audio and DVD multimedia devices, joystick ports, and full-motion video-capture devices.ModemClass = ModemClassGuid = {4d36e96d-e325-11ce-bfc1-0}This class installs modems. An INF for a device of this class installs no device driver(s), but rather specifies the features and configuration information of a particular modem and stores this information in the registry. See also the Multifunction class.MonitorClass = MonitorClassGuid = {4d36e96e-e325-11ce-bfc1-0}This class includes display monitors. An INF for a device of this class installs no device driver(s), but rather specifies the features of a particular monitor to be stored in the registry for use by drivers of video adapters. (Monitors are enumerated as the child devices of display adapters.)MouseClass = MouseClassGuid = {4d36e96f-e325-11ce-bfc1-0}This class includes all mice and other kinds of pointing devices, such as trackballs. That is, it also must be specified in the (secondary) INF for an enumerated "child" HID mouse device.Multifunction DevicesClass = MultifunctionClassGuid = {4d36e971-e325-11ce-bfc1-0}This class includes combo cards, such as a PCMCIA modem and netcard adapter. The driver for such a PnP multifunction device is installed under this class and enumerates the modem and netcard separately as its "child" devices.Multi-port Serial AdaptersClass = MultiportSerialClassGuid = {50906cb8-ba12-11d1-bf5d-}This class includes intelligent multiport serial cards, but not peripheral devices that connect to its ports. It does not include unintelligent (16550-type) mutiport serial controllers or single-port serial controllers (see the Ports class).Network AdapterClass = NetClassGuid = {4d36e972-e325-11ce-bfc1-0}This class includes NDIS NIC miniports excluding Fast-IR miniports, NDIS intermediate drivers (of "virtual adapters"), and CoNDIS MCM miniports.Network ClientClass = NetClientClassGuid = {4d36e973-e325-11ce-bfc1-0}This class includes network and/or print providers.Network ServiceClass = NetServiceClassGuid = {4d36e974-e325-11ce-bfc1-0}This class includes network services, such as redirectors and servers.Network TransportClass = NetTransClassGuid = {4d36e975-e325-11ce-bfc1-0}This class includes NDIS protocols, CoNDIS stand-alone call managers, and CoNDIS clients, as well as higher level drivers in transport stacks.PCMCIA AdaptersClass = PCMCIAClassGuid = {4d36e977-e325-11ce-bfc1-0}This class includes system-supplied drivers of PCMCIA and CardBus host controllers, but not drivers of PCMCIA or CardBus peripherals.Ports (COM & LPT serial ports)Class = PortsClassGuid = {4d36e978-e325-11ce-bfc1-0}This class includes drivers of serial or parallel port devices, but see also the MultiportSerial class.PrinterClass = PrinterClassGuid = {4d36e979-e325-11ce-bfc1-0}This class includes printers.SCSI and RAID ControllersClass = SCSIAdapterClassGuid = {4d36e97b-e325-11ce-bfc1-0}This class includes SCSI HBA miniports and disk-array controller drivers.Smart Card ReadersClass = SmartCardReaderClassGuid = {50dd5230-ba8a-11d1-bf5d-}This class includes drivers for smart card readers.Storage VolumesClass = VolumeClassGuid = {71a27cdd-812a-11d0-bec7-0f}This class includes storage volumes as defined by the system-supplied logical volume manager and class drivers that create device objects to represent storage volumes, such as the system disk class driver.System DevicesClass = SystemClassGuid = {4d36e97d-e325-11ce-bfc1-0}This class includes the Windows? 2000 HALs, system bus drivers, the system ACPI driver, and the system volume-manager driver. It also includes battery drivers and UPS drivers.Tape DrivesClass = TapeDriveClassGuid = {6dd21-11cf-801c-0}This class includes drivers of tape drives, including all tape miniclass drivers.USBClass = USBClassGuid = {36fc9e60-c465-11cf-40000}This class includes system-supplied (bus) drivers of USB host controllers and drivers of USB hubs, but not drivers of USB peripherals.The following classes and GUIDs should not be used to install devices (or drivers) on Windows 2000 platforms:AdapterClass = AdapterClassGUID = {4d36e964-e325-11ce-bfc1-0}This class is obsolete.APMClass = APMSupportClassGUID = {d45b1c18-c8fa-11d1-9f77-}This class is reserved for system use.ComputerClass = ComputerClassGUID = {4d36e966-e325-11ce-bfc1-0}This class is reserved for system use.DecodersClass = DecoderClassGUID = {6bdd1fc2-810f-11d0-bec7-0f}This class is reserved for future use.Global Positioning SystemClass = GPSClassGUID = {6bdd1fc3-810f-11d0-bec7-0f}This class is reserved for future use.No driverClass = NoDriverClassGUID = {4d36e976-e325-11ce-bfc1-0}This class is obsolete.Non-Plug and Play DriversClass = LegacyDriverClassGUID = {8ecc055d-047f-11d1-a537-ed1}This class is reserved for system use.Other DevicesClass = UnknownClassGUID = {4d36e97e-e325-11ce-bfc1-0}This class is reserved for system use. Enumerated devices for which the system cannot determine the type are installed under this class. Do not use this class if you're unsure in which class either determine the correct device setup class or create a new class.Printer UpgradeClass = Printer UpgradeClassGUID = {4d36e97a-e325-11ce-bfc1-0}This class is reserved for system use.SoundClass = SoundClassGUID = {4d36e97c-e325-11ce-bfc1-0}This class is obsolete.USB Mass Storage DeviceClassGUID = a5dcbf10--901f-00c04fb951ed//-------------------------------------------------------------------<转载自: /tikuanyinok/blog/item/b39c0701b086.html
阅读(4046) | 评论(0) | 转发(1) |
相关热门文章
给主人留下些什么吧!~~
请登录后评论。2012年12月 .NET技术大版内专家分月排行榜第三
匿名用户不能发表回复!|
每天回帖即可获得10分可用分!小技巧:
你还可以输入10000个字符
(Ctrl+Enter)
请遵守CSDN,不得违反国家法律法规。
转载文章请注明出自“CSDN(www.csdn.net)”。如是商业用途请联系原作者。1318人阅读
arm-Linux学习(61)
一、获取/dev/input/event16设备的vid和pid
#include &linux/types.h&
#include &linux/input.h&
#include &linux/hidraw.h&
#include &sys/ioctl.h&
#include &sys/types.h&
#include &sys/stat.h&
#include &fcntl.h&
#include &unistd.h&
#include &poll.h&
#include &time.h&
#include &math.h&
#include &stdio.h&
#include &stdint.h&
#include &string.h&
#include &stdlib.h&
#include &errno.h&
int main(){
char filename[64];
strcpy(filename,&/dev/input/event16&);
char name[80];
int fd = open(filename, O_RDWR /*| O_NONBLOCK*/);
if(fd &= 0) {
printf(&TK-----------&&&&open error\n&);
return -1;
struct input_id inputId;
int rc = ioctl(fd, EVIOCGID, &inputId);
printf(&TK--------&&&&info.vendor is 0x%x\n&,inputId.vendor);
printf(&TK--------&&&&info.product is 0x%x\n&,inputId.product);
printf(&TK--------&&&&info.bustype is 0x%x\n&,inputId.bustype);
struct hidraw_
int rc = ioctl(fd, HIDIOCGRAWINFO, &info);
printf(&TK--------&&&&info.vendor is 0x%x\n&,info.vendor);
printf(&TK--------&&&&info.product is 0x%x\n&,info.product);
printf(&TK--------&&&&info.bustype is 0x%x\n&,info.bustype);
///////////
struct hidraw_report_d
rc = ioctl(fd, HIDIOCGRDESC, &descriptor);
printf(&TK--------&&&&descriptor.size is 0x%04x\n&,descriptor.size);
int descriptorSize=0;
rc = ioctl(fd, HIDIOCGRDESCSIZE, &descriptorSize);
printf(&TK--------&&&&descriptorSize is 0x%04x\n&,descriptorSize);
name[sizeof(name) - 1] = &#39;\0&#39;;
if(ioctl(fd, EVIOCGNAME(sizeof(name) - 1), &name) & 1) {
name[0] = &#39;\0&#39;;
printf(&TK-------&&&name is %s\n&,name);
close(fd);
Android.mk
LOCAL_PATH:= $(call my-dir)
include $(CLEAR_VARS)
LOCAL_SRC_FILES:= \
LOCAL_SHARED_LIBRARIES := \
LOCAL_MODULE:= testinput
LOCAL_MODULE_TAGS := optional
include $(BUILD_EXECUTABLE)三、运行TK--------&&&&info.vendor is 0x0
TK--------&&&&info.product is 0x1
TK--------&&&&info.bustype is 0x19
TK--------&&&&descriptor.size is 0x0000
TK--------&&&&descriptorSize is 0x0000
TK-------&&&name is Power Button
参考知识库
* 以上用户言论只代表其个人观点,不代表CSDN网站的观点或立场
访问:565413次
积分:8047
积分:8047
排名:第1862名
原创:291篇
转载:42篇
(2)(2)(1)(3)(2)(4)(13)(2)(6)(19)(3)(2)(3)(11)(6)(1)(5)(20)(4)(4)(4)(10)(4)(9)(12)(5)(6)(10)(13)(9)(11)(6)(6)(4)(26)(7)(7)(7)(20)(16)(23)(3)(3)

我要回帖

更多关于 易语言pid取窗口句柄 的文章

 

随机推荐