Important:
This is retired content. This content is outdated and is no longer being maintained. It is provided as a courtesy for individuals who are still using these technologies. This content may contain URLs that were valid when originally published, but now link to sites or pages that no longer exist.
A version of this page is also available for
Windows Mobile Supported Windows Embedded CE Supported
4/14/2010

This function searches for device information and fills a DEVMGR_DEVICE_INFORMATIONstructure with this information.

Syntax

HANDLE FindFirstDevice(
  DeviceSearchType 
searchType,
  LPCVOID 
pvSearchParam,
  PDEVMGR_DEVICE_INFORMATION 
pdi
);

Parameters

searchType

[in] Method of searching for a device. Set to an element of the DeviceSearchTypeenumeration.

pvSearchParam

[in] Pointer to a string, pointer to a GUID, or an activation handle. The following table shows examples of these based on the element of DeviceSearchType passed in searchType.

searchType pvSearchParam

DeviceSearchByLegacyName

L"COM*" for all COMx: devices.

DeviceSearchByDeviceName

L"COM*" for all COMx devices.

DeviceSearchByBusName

L"PCI_0_3*" for PCI_0_3_0, PCI_0_3_1 and so on.

DeviceSearchByGuid

Pointer to a GUID.

DeviceSearchByParent

Activation handle value from ActivateDeviceEx.

pdi

[out] Pointer to a DEVMGR_DEVICE_INFORMATIONstructure to store the device's information.

Return Value

If successful, FindFirstDevicereturns a search handle that can be used in subsequent calls to FindNextDevice. If the function is not successful, it returns INVALID_HANDLE_VALUE. To obtain extended error information, the application can call the GetLastErrorfunction.

Remarks

Wildcards are supported in name-based searches. Unnamed devices can be found using a zero-length search string.

Close the handle with FindClosewhen searching is complete.

Requirements

Header winbase.h
Windows Embedded CE Windows CE 5.0 and later
Windows Mobile Windows Mobile Version 5.0 and later

See Also