RequestDeviceNotifications (Compact 2013)

3/26/2014

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

Syntax

HANDLE RequestDeviceNotifications(
  const GUID* devclass,
  HANDLE hMsgQ,
  BOOL fAll
);

Parameters

  • devclass
    [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.
  • hMsgQ
    [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.

  • fAll
    [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.

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.

Requirements

Header

winbase.h

Library

coredll.lib

See Also

Reference

Device Interface Notifications Functions
DEVDETAIL
StopDeviceNotifications

Other Resources

CreateMsgQueue