SetNtmsDeviceChangeDetection function (ntmsapi.h)

[Removable Storage Manager is no longer available as of Windows 7 and Windows Server 2008 R2.]

The SetNtmsDeviceChangeDetection function sets one or more target devices for change detection.

Syntax

DWORD SetNtmsDeviceChangeDetection(
  [in] HANDLE      hSession,
  [in] HANDLE      DetectHandle,
  [in] LPNTMS_GUID lpRequestId,
  [in] DWORD       dwType,
  [in] DWORD       dwCount
);

Parameters

[in] hSession

Handle to the session returned by the OpenNtmsSession function.

[in] DetectHandle

Device change detection handle from BeginNtmsDeviceChangeDetection, or NULL for a single poll.

[in] lpRequestId

Object identifier for the target device. This parameter can be one or more library, media type, or physical media GUIDs. All GUIDs must be the same type.

[in] dwType

Type of object identifiers specified in the lpObjectId parameter. This parameter can be one of the following values from the NtmsObjectsTypes enumeration type: NTMS_LIBRARY, NTMS_MEDIA_TYPE, or NTMS_PHYSICAL_MEDIA.

[in] dwCount

Number of object identifiers in lpObjectId.

Return value

This function returns one of the following values.

Value Meaning
ERROR_INVALID_HANDLE
The session or detection handle is not valid.
ERROR_INVALID_PARAMETER
The object type is not valid.
ERROR_INVALID_LIBRARY
The specified library was not found.
ERROR_INVALID_MEDIA
The specified media or type was not found.
ERROR_SUCCESS
The operator request has been canceled.

Remarks

The device can be specified directly by passing library GUIDs or indirectly by passing physical media or media type GUIDs. When using the indirect specification, all stand-alone libraries that could contain the media or media type are detected. All devices specified continue to be detected until the device change detection handle is closed using the EndNtmsDeviceChangeDetection function.

This function can also be used to poll for changed media in the specified devices. This is typically used by a UI when opening a leaf node or implementing a refresh option.

Requirements

Requirement Value
Minimum supported client Windows XP [desktop apps only]
Minimum supported server Windows Server 2003 [desktop apps only]
Target Platform Windows
Header ntmsapi.h
Library Ntmsapi.lib
DLL Ntmsapi.dll

See also

BeginNtmsDeviceChangeDetection

Change Detection Functions

EndNtmsDeviceChangeDetection