DrgAcceptDroppedFiles: Difference between revisions
No edit summary |
|||
Line 26: | Line 26: | ||
This function handles the file direct manipulation protocol for a given window. The window responds (DOR_DROP, usDefaultOp) to DM_DRAGOVER messages for items with a type matching the acceptable type string and with a rendering mechanism and format of <DRM_OS2FILE,DRF_UNKNOWN>. Not all dragged objects must match this criteria for the drop to be acceptable. | This function handles the file direct manipulation protocol for a given window. The window responds (DOR_DROP, usDefaultOp) to DM_DRAGOVER messages for items with a type matching the acceptable type string and with a rendering mechanism and format of <DRM_OS2FILE,DRF_UNKNOWN>. Not all dragged objects must match this criteria for the drop to be acceptable. | ||
After the drop occurs, this function handles the conversation required to complete the direct manipulation operation for all acceptable objects. A DM_ENDCONVERSATION (DMFL_TARGETFAIL) message is sent to the source when an object is unacceptable. | After the drop occurs, this function handles the conversation required to complete the direct manipulation operation for all acceptable objects. A [[DM_ENDCONVERSATION]] (DMFL_TARGETFAIL) message is sent to the source when an object is unacceptable. | ||
When an error occurs during a move or copy, the caller is sent a DM_DRAGERROR message. The caller can take corrective action. | When an error occurs during a move or copy, the caller is sent a [[DM_DRAGERROR]] message. The caller can take corrective action. | ||
As the move or copy operation is successfully completed for each file, a DM_DRAGFILECOMPLETE message is sent to the caller. No message is sent when the operation fails. | As the move or copy operation is successfully completed for each file, a [[DM_DRAGFILECOMPLETE]] message is sent to the caller. No message is sent when the operation fails. | ||
The function returns TRUE if the operation is successful and FALSE if an error occurs. | The function returns TRUE if the operation is successful and FALSE if an error occurs. | ||
==Example Code== | ==Example Code== |
Latest revision as of 23:55, 14 May 2025
This function handles the file direct manipulation protocol for a given window.
Syntax
DrgAcceptDroppedFiles(hwnd, pszPath, pszTypes, ulDefaultOp, ulRsvd)
Parameters
- hwnd (HWND) - input
- Handle of calling window.
- pszPath (PSZ) - input
- Directory in which to place the dropped files.
- If NULL, the files are placed in the current directory.
- pszTypes (PSZ) - input
- List of types that are acceptable to the drop.
- This string is of the form:
type[,type...]
- When this pointer is NULL, any type of file will be accepted.
- ulDefaultOp (ULONG) - input
- Default drag operation for this window.
- The operation is either DO_MOVE or DO_COPY.
- ulRsvd (ULONG) - input
- Reserved.
Returns
- rc (BOOL) - returns
- Success indicator.
- TRUE
- Successful completion.
- FALSE
- Error occurred.
Remarks
This function handles the file direct manipulation protocol for a given window. The window responds (DOR_DROP, usDefaultOp) to DM_DRAGOVER messages for items with a type matching the acceptable type string and with a rendering mechanism and format of <DRM_OS2FILE,DRF_UNKNOWN>. Not all dragged objects must match this criteria for the drop to be acceptable.
After the drop occurs, this function handles the conversation required to complete the direct manipulation operation for all acceptable objects. A DM_ENDCONVERSATION (DMFL_TARGETFAIL) message is sent to the source when an object is unacceptable.
When an error occurs during a move or copy, the caller is sent a DM_DRAGERROR message. The caller can take corrective action.
As the move or copy operation is successfully completed for each file, a DM_DRAGFILECOMPLETE message is sent to the caller. No message is sent when the operation fails.
The function returns TRUE if the operation is successful and FALSE if an error occurs.
Example Code
#define INCL_WINSTDDRAG #include <os2.h> HWND hwnd; /* Handle of calling window. */ PSZ pszPath; /* Directory in which to place the dropped files. */ PSZ pszTypes; /* List of types that are acceptable to the drop. */ ULONG ulDefaultOp; /* Default drag operation for this window. */ ULONG ulRsvd; /* Reserved. */ BOOL rc; /* Success indicator. */ rc = DrgAcceptDroppedFiles(hwnd, pszPath, pszTypes, ulDefaultOp, ulRsvd);
This example uses the DrgAcceptDroppedFiles function to define the direct manipulation protocol of the given window, accept all file types, and use the current directory as the drop directory.
#define INCL_WINSTDDRAG /* Direct Manipulation (Drag) Functions */ #include <os2.h> BOOL fSuccess; /* Indicate success or failure */ HWND Hwnd; /* Handle of calling window */ PSZ pszPath; /* Directory in which to place the */ /* dropped files */ PSZ pszTypes; /* A list of types that are acceptable */ ULONG ulDefaultOp; /* Default drag operation */ pszPath = NULL; /* Drop file in current directory */ pszTypes = NULL; /* Accept any file type */ ulDefaultOp = DO_MOVE; /* Default drag operation is move */ fSuccess = DrgAcceptDroppedFiles(Hwnd, pszPath, pszTypes, ulDefaultOp, 0);