Partager via


Inter-process Drag-and-Drop Operations

MMC 2.0 supports the dragging of an item from one instance of mmc.exe to another instance of mmc.exe (both instances of mmc.exe must be running MMC 2.0). To facilitate this feature, MMC 2.0 introduces the MMCN_CANPASTE_OUTOFPROC notification. If an inter-process drag-and-drop operation is performed, and the drop target snap-in had earlier indicated (by its response to the MMCN_CANPASTE_OUTOFPROC notification) that it accepts data objects from other MMC processes, then the drag source data object will be sent to the drop target as part of a MMCN_QUERY_PASTE notification. If the drop target snap-in had earlier indicated that it does not accept data objects from other MMC processes, then the MMCN_QUERY_PASTE notification is not sent.

Be aware that a snap-in, OCX, or external application can directly copy data onto the clipboard, in which case MMC does not know the details of the data object. In this event, MMC 2.0 behaves as did MMC 1.2 - the data object will be sent to the snap-in (as part of the MMCN_QUERY_PASTE notification) regardless of the snap-in's response to the MMCN_CANPASTE_OUTOFPROC notification. Also, a snap-in running in MMC 2.0 always receives a MMCN_CANPASTE_OUTOFPROC notification.

When your snap-in receives data from a different process, do not cast (using C or C++ techniques) the provided IDataObject interface to its internal implementation; the data object is actually a marshaled interface. Instead, retrieve data from the data object by either a) implementing a marshaling interface on the data object (then have the drop target query and use that interface) or b) calling the IDataObject::GetData or IDataObject::GetDataHere method using clipboard formats, which do not contain any process-specific information (hence, pointers, handles, and so on cannot be part of the clipboard data).