DrgAcceptDroppedFiles: Difference between revisions
mNo edit summary |
|||
Line 1: | Line 1: | ||
This function handles the file direct manipulation protocol for a given window. | This function handles the file direct manipulation protocol for a given window. | ||
==Syntax== | ==Syntax== | ||
DrgAcceptDroppedFiles(hwnd, pszPath, pszTypes, ulDefaultOp, ulRsvd) | DrgAcceptDroppedFiles(hwnd, pszPath, pszTypes, ulDefaultOp, ulRsvd) | ||
==Parameters== | ==Parameters== | ||
;hwnd (HWND) - input | ;hwnd (HWND) - input:Handle of calling window. | ||
: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. | |||
;pszPath (PSZ) - input | ;pszTypes (PSZ) - input:List of types that are acceptable to the drop. | ||
: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: | :This string is of the form: | ||
type[,type...] | type[,type...] | ||
:When this pointer is NULL, any type of file will be accepted. | :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== | ==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. | 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. | ||
Line 45: | Line 33: | ||
==Example Code== | ==Example Code== | ||
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. | |||
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. | |||
<pre> | <pre> | ||
#define INCL_WINSTDDRAG /* Direct Manipulation (Drag) Functions */ | #define INCL_WINSTDDRAG /* Direct Manipulation (Drag) Functions */ | ||
Line 76: | Line 49: | ||
ulDefaultOp = DO_MOVE; /* Default drag operation is move */ | ulDefaultOp = DO_MOVE; /* Default drag operation is move */ | ||
fSuccess = DrgAcceptDroppedFiles(Hwnd, pszPath, pszTypes, | fSuccess = DrgAcceptDroppedFiles(Hwnd, pszPath, pszTypes, ulDefaultOp, 0); | ||
</pre> | </pre> | ||
==Related Functions== | ==Related Functions== | ||
*DrgDragFiles | *DrgDragFiles | ||
[[Category:Drg]] | [[Category:Drg]] |
Revision as of 16:35, 7 November 2023
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
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);
Related Functions
- DrgDragFiles