找回密码
 加入
搜索
查看: 3510|回复: 4

如何检测出储存卡的类型,如:SD卡,MS卡等....

[复制链接]
发表于 2009-9-28 18:34:41 | 显示全部楼层 |阅读模式
我想用AU3来提取插入的储存卡类型(可以利用第三方软件),
有什么软件可以实现吗,在网上找了1个多小时没发现?
大伙看看啊,有没有人做过类似的小软件啊。
发表于 2009-9-28 19:07:48 | 显示全部楼层
SetupDiGetClassDevs
SetupDiEnumDeviceInfo
SetupDiGetDeviceRegistryProperty
3个函数结合使用,就能判断出来了。
http://msdn.microsoft.com/en-us/library/dd406734.aspx
 楼主| 发表于 2009-9-28 19:21:06 | 显示全部楼层
2# pusofalse
Windows驱动程序工具包:设备安装
SetupDiGetClassDevs SetupDiGetClassDevs

The SetupDiGetClassDevs function returns a handle to a device information set that contains requested device information elements for a local machine.该SetupDiGetClassDevs函数返回的句柄设备信息集 ,包含要求本地机器设备的信息内容。

HDEVINFO HDEVINFO
SetupDiGetClassDevs( SetupDiGetClassDevs(
IN LPGUID ClassGuid ..OPTIONAL, 在LPGUID ClassGuid ..可选,
IN PCTSTR Enumerator ..OPTIONAL, 在PCTSTR 枚举 ..可选,
IN HWND hwndParent ..OPTIONAL, 在HWND hwndParent ..可选,
IN DWORD Flags 在双字节值 标志
); );

    Parameters参数
ClassGuid ClassGuid
    A pointer to the GUID for a device setup class or a device interface class.向为设备安装类或设备接口类GUID指针。 This pointer is optional and can be NULL.该指针是可选的,可以为NULL。 For more information about how to set ClassGuid , see the following Comments section.欲了解更多有关如何设置ClassGuid信息,请参阅下面的评论。
Enumerator 枚举
    A pointer to a NULL-terminated string that specifies:阿以NULL指针结束的字符串,其中载明:

        * An identifier (ID) of a Plug and Play (PnP) enumerator .一个标识符(ID)的即插即用(PnP)功能枚举 。 This ID can either be the value's globally unique identifier (GUID) or symbolic name.这个ID可以是值的全局唯一标识符(GUID)或象征性的名称。 For example, “PCI” can be used to specify the PCI PnP value.例如,“的PCI”可用于指定的PCI即插即用的价值。 Other examples of symbolic names for PnP values include “USB,” “PCMCIA,” and “SCSI”.即插即用价值的符号名的其他例子包括的“USB”,“的PCMCIA”和“的SCSI”。
        * A PnP device instance ID .阿即插即用设备实例ID。 When specifying a PnP device instance ID, DIGCF_DEVICEINTERFACE must be set in the Flags parameter.当指定PnP设备实例ID,DIGCF_DEVICEINTERFACE必须设置在flags参数。

    This pointer is optional and can be NULL.该指针是可选的,可以为NULL。 If an enumeration value is not used to select devices, set Enumerator to NULL如果枚举值不是用于选择设备,设置为NULL 枚举

    For more information about how to set the Enumerator value, see the following Comments section.如需有关如何设置枚举值,请参阅下面的评论信息。
hwndParent hwndParent
    A handle of the top-level window to be used for a user interface that is associated with installing a device instance in the device information set.一个顶层窗口句柄是一个用户界面,与安装在设备信息设备的使用实例相关规定。 This handle is optional and can be NULL.这种处理是可选的,可以为NULL。
Flags 旗
    A variable of type DWORD that specifies control options that filter the device information elements that are added to the device information set.类型的变量双字节值,指定控制的过滤设备信息元素,添加到设备的信息选项。 This parameter can be a bitwise OR of zero or more of the following flags.此参数可以是零或以下标志位或。 For more information about combining these flags, see the following Comments section.如需有关这些标志的信息相结合,请参阅下面的评论。

    DIGCF_ALLCLASSES DIGCF_ALLCLASSES
        Return a list of installed devices for all device setup classes or all device interface classes.返回一个列表的所有设备安装类别或所有设备接口类安装设备。
    DIGCF_DEVICEINTERFACE DIGCF_DEVICEINTERFACE
        Return devices that support device interfaces for the specified device interface classes.返回设备支持设备指定设备接口类接口。 This flag must be set in the Flags parameter if the Enumerator parameter specifies a device instance ID .此标志必须在参数设置标志 ,如果枚举参数指定的设备实例ID。
    DIGCF_DEFAULT DIGCF_DEFAULT
        Return only the device that is associated with the system default device interface, if one is set, for the specified device interface classes.只返回是与系统默认设备接口关联的设备,如果设置,指定设备接口类。
    DIGCF_PRESENT DIGCF_PRESENT
        Return only devices that are currently present in a system.回报目前在一个系统中的专用设备。
    DIGCF_PROFILE DIGCF_PROFILE
        Return only devices that are a part of the current hardware profile.仅返回装置是目前硬件配置文件的一部分。

Return Value返回值

If the operation succeeds, SetupDiGetClassDevs returns a handle to a device information set that contains all installed devices that matched the supplied parameters.如果操作成功,SetupDiGetClassDevs返回的句柄设备信息集 ,其中包含所有已安装的设备提供的参数匹配。 If the operation fails, the function returns INVALID_HANDLE_VALUE.如果操作失败,则函数返回INVALID_HANDLE_VALUE。 To get extended error information, call GetLastError .为了获得更多错误信息, 调用 GetLastError。

Comments评论

The caller of SetupDiGetClassDevs must delete the returned device information set when it is no longer needed by calling SetupDiDestroyDeviceInfoList .在SetupDiGetClassDevs调用者必须删除设备的信息返回时设置不再是通过调用SetupDiDestroyDeviceInfoList需要。

Call SetupDiGetClassDevsEx to retrieve the devices for a class on a remote machine.呼叫SetupDiGetClassDevsEx以检索在远程计算机类的设备。
Device Setup Class Control Options设备安装类控制选项

Use the following filtering options to control whether SetupDiGetClassDevs returns devices for all device setup classes or only for a specified device setup class:使用下面的过滤选项来控制是否SetupDiGetClassDevs返回装置所有设备安装类别或只在特定的设备安装类别:

    * To return devices for all device setup classes, set the DIGCF_ALLCLASSES flag, and set the ClassGuid parameter to NULL.若要返回所有设备安装类别装置,设置DIGCF_ALLCLASSES标志,并设置ClassGuid参数为NULL。
    * To return devices only for a specific device setup class, do not set DIGCF_ALLCLASSES, and use ClassGuid to supply the GUID of the device setup class.只返回一个特定的设备安装类设备,不设置DIGCF_ALLCLASSES,并使用ClassGuid提供设备的安装程序类GUID。

In addition, you can use the following filtering options in combination with one another to further restrict which devices are returned:此外,您可以使用下面的过滤配合,进一步限制哪些设备组合选择返回:

    * To return only devices that are present in the system, set the DIGCF_PRESENT flag.为了回报在系统中存在的专用设备,设置DIGCF_PRESENT标志。
    * To return only devices that are part of the current hardware profile, set the DIGCF_PROFILE flag.若要返回属于当前硬件配置文件的一部分的专用设备,设置DIGCF_PROFILE标志。
    * To return devices only for a specific PnP enumerator , use the Enumerator parameter to supply the GUID or symbolic name of the enumerator . If Enumerator is NULL, SetupDiGetClassDevs returns devices for all PnP enumerators.只返回一个特定即插即用枚举设备,使用枚举器参数提供的GUID或枚举符号名。如果枚举为NULL,SetupDiGetClassDevs返回所有即插即用枚举设备。

Device Interface Class Control Options设备接口类控制选项

Use the following filtering options to control whether SetupDiGetClassDevs returns devices that support any device interface class or only devices that support a specified device interface class:使用下面的过滤选项来控制是否SetupDiGetClassDevs返回设备支持任何设备接口类或只支持一个设备指定的设备接口类:

    * To return devices that support a device interface of any class, set the DIFCF_DEVICEINTERFACE flag, set the DIGCF_ALLCLASSES flag, and set ClassGuid to NULL.要返回设备支持任何类别的设备接口,设置DIFCF_DEVICEINTERFACE标志,设置DIGCF_ALLCLASSES标志,并设置ClassGuid为NULL。 The function adds to the device information set a device information element that represents such a device and then adds to the device information element a device interface list that contains all the device interfaces that the device supports.函数增加了设备信息设备信息设置一个元素,就是这样一种设备,然后添加到设备信息元素设备接口列表,其中包含所有的设备接口设备支持。
    * To return only devices that support a device interface of a specified class, set the DIFCF_DEVICEINTERFACE flag and use the ClassGuid parameter to supply the class GUID of the device interface class.只返回设备支持的一个指定的类设备接口,设置DIFCF_DEVICEINTERFACE标志和使用ClassGuid参数供应类GUID的设备接口类。 The function adds to the device information set a device information element that represents such a device and then adds a device interface of the specified class to the device interface list for that device information element.函数增加了设备信息设备信息设置一个元素,就是这样一种设备,然后添加一个指定类设备接口,该设备的信息元素设备接口列表。

In addition, you can use the following filtering options to control whether SetupDiGetClassDevs returns only devices that support the system default interface for device interface classes:此外,您可以使用下列过滤选项来控制是否SetupDiGetClassDevs只返回设备支持的设备接口类系统的默认界面:

    * To return only the device that supports the system default interface, if one is set, for a specified device interface class, set the DIFCF_DEVICEINTERFACE flag, set the DIGCF_DEFAULT flag, and use ClassGuid to supply the class GUID of the device interface class.只返回该设备支持系统默认的界面,如果设置,为指定的设备接口类,设置DIFCF_DEVICEINTERFACE标志,设置DIGCF_DEFAULT旗帜,用ClassGuid提供的类GUID的设备接口类。 The function adds to the device information set a device information element that represents such a device and then adds the system default interface to the device interface list for that device information element.函数增加了设备信息设备信息设置一个元素,就是这样一种装置,然后将系统的默认接口该设备的信息元素设备接口列表。

    * To return a device that supports a system default interface for an unspecified device interface class, set the DIFCF_DEVICEINTERFACE flag, set the DIGCF_ALLCLASSES flag, set the DIGCF_DEFAULT flag, and set ClassGuid to NULL.返回一个设备支持一个没有指明的设备接口类系统的默认界面,设置DIFCF_DEVICEINTERFACE标志,设置DIGCF_ALLCLASSES标志,设置DIGCF_DEFAULT标志,并设置ClassGuid为NULL。 The function adds to the device information set a device information element that represents such a device and then adds the system default interface to the device interface list for that device information element.函数增加了设备信息设备信息设置一个元素,就是这样一种装置,然后将系统的默认接口该设备的信息元素设备接口列表。

You can also use the following options in combination with the other options to further restrict which devices are returned:您也可以使用其他选项,以进一步限制哪些设备结合下列选项返回:

    * To return only devices that are present in the system, set the DIGCF_PRESENT flag.为了回报在系统中存在的专用设备,设置DIGCF_PRESENT标志。
    * To return only devices that are part of the current hardware profile, set the DIGCF_PROFILE flag.若要返回属于当前硬件配置文件的一部分的专用设备,设置DIGCF_PROFILE标志。
    * To return only a specific device, set the DIFCF_DEVICEINTERFACE flag and use the Enumerator parameter to supply the device instance ID of the device . To include all possible devices, set Enumerator to NULL.只返回一个特定的设备,设置DIFCF_DEVICEINTERFACE标志和使用枚举器参数来提供设备实例ID的设备。要包括所有可能的设备,设置枚举为NULL。

Examples实例

The following are some examples of how to use the SetupDiGetClassDevs function.以下是如何使用SetupDiGetClassDevs函数的一些例子。

Example 1: Build a list of all devices in the system, including devices that are not currently present. 示例1:建立一个系统内的所有设备,包括设备,目前未出席名单。

    Handle = SetupDiGetClassDevs(NULL, NULL, NULL, DIGCF_ALLCLASSES);拉手= SetupDiGetClassDevs(空,空,空,DIGCF_ALLCLASSES);
Example 2: Build a list of all devices that are present in the system. 例2:建立一个对所有设备的系统中存在的列表。

    Handle = SetupDiGetClassDevs(NULL, NULL, NULL, DIGCF_ALLCLASSES | DIGCF_PRESENT);拉手= SetupDiGetClassDevs(空,空,空,DIGCF_ALLCLASSES | DIGCF_PRESENT);
Example 3: Build a list of all devices that are present in the system that are from the network adapter device setup class . 示例3:建立一个对所有设备,这些设备在系统中从网络适配器的设备安装类别中存在清单。

    Handle = SetupDiGetClassDevs(&GUID_DEVCLASS_NET, NULL, NULL, DIGCF_PRESENT);拉手= SetupDiGetClassDevs(&GUID_DEVCLASS_NET,空,空,DIGCF_PRESENT);
Example 4: Build a list of all devices that are present in the system that have enabled an interface from the storage volume device interface class . 示例4:建立一个对所有设备,主要因为使存储量从设备接口类的接口系统的名单。

    Handle = SetupDiGetClassDevs(&GUID_DEVINTERFACE_VOLUME, NULL, NULL, DIGCF_PRESENT | DIGCF_INTERFACEDEVICE);拉手= SetupDiGetClassDevs(&GUID_DEVINTERFACE_VOLUME,空,空,DIGCF_PRESENT | DIGCF_INTERFACEDEVICE);

Requirements需求

Versions: The SetupDiGetClassDevs function is available in Microsoft Windows 2000 and later versions of Windows. 版本:该SetupDiGetClassDevs功能可在Microsoft Windows 2000和更高版本的Windows。

Headers: Declared in Setupapi.h . 标题:宣布Setupapi.h。 Include Setupapi.h .包括Setupapi.h。

See Also参见


看不懂这个,不知道怎么使用这些函数?????
发表于 2009-9-28 22:09:42 | 显示全部楼层
关注中,也想了解这方面的内容。
 楼主| 发表于 2009-9-30 14:09:03 | 显示全部楼层
希望有人能做出来,大家参考参考...................
您需要登录后才可以回帖 登录 | 加入

本版积分规则

QQ|手机版|小黑屋|AUTOIT CN ( 鲁ICP备19019924号-1 )谷歌 百度

GMT+8, 2024-9-22 19:40 , Processed in 0.074162 second(s), 22 queries .

Powered by Discuz! X3.5 Licensed

© 2001-2024 Discuz! Team.

快速回复 返回顶部 返回列表