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

This function requests notifications for the appearance and disappearance of device interfaces.


HANDLE RequestDeviceNotifications(
  const GUID* 



[in] Pointer to a device interface GUID. Setting to NULL requests notifications for all device interfaces. NULL is not recommended because it creates extra work for the Device Manager and in most cases is unnecessary. Typically, you know in advance what interfaces you want.


[in] Handle to a message queue returned from CreateMsgQueue.

Create the message queue referenced by hMsgQwith fixed-size messages. Create the queue with CreateMsqQueue. If you want to know when device interfaces appear and disappear, create the queue and wait for messages to come in on the queue. Each message causes the queue synchronization object to be signaled. For an example, see %_WINCEROOT%\Public\Wceshellfe\Oak\Ctlpnl\Cplmain\Power.cpp.

The maximum size of a message depends on the interface class requested, but cannot exceed MAX_DEVCLASS_NAMELEN in any case. The size depends on the interface class. The interface class can determine how long the name of the device interface being reported is expected to be. For example, the stream interface class is only five characters: COM1:, COM2:, and so on. Use MAX_DEVCLASS_NAMELEN as the maximum interface name length.

The notifications sent to hMsgQare a sequence of DEVDETAILstructures with extra TCHARtypes appended to account for the instance names.


[in] Notifications for all currently existing devices are sent if fAllis TRUE. Otherwise, if fAllis FALSE, then notifications are sent only for subsequent changes.

Return Value

Returns a notification handle. A value of NULL indicates an error. Do not wait on the notification handle, wait on the message queue handle. Use the notification handle as the parameter to StopDeviceNotifications.


Header winbase.h
Library coredll.lib
Windows Embedded CE Windows CE .NET 4.0 and later
Windows Mobile Windows Mobile Version 5.0 and later

See Also