Other versions of this page are also available for the following:
This function requests notifications for the appearance and disappearance of device interfaces.
HANDLE RequestDeviceNotifications( const GUID* devclass, HANDLE hMsgQ, BOOL fAll );
[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 hMsgQ with 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 hMsgQ are a sequence of DEVDETAIL structures with extra TCHAR types appended to account for the instance names.
[in] Notifications for all currently existing devices are sent if fAll is TRUE. Otherwise, if fAll is FALSE, then notifications are sent only for subsequent changes.
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.
|Windows Embedded CE||Windows CE .NET 4.0 and later|
|Windows Mobile||Windows Mobile Version 5.0 and later|