OleUIPasteSpecialA function (oledlg.h)
Invokes the standard Paste Special dialog box, allowing the user to select the format of the clipboard object to be pasted or paste-linked.
Syntax
UINT OleUIPasteSpecialA(
[in] LPOLEUIPASTESPECIALA unnamedParam1
);
Parameters
[in] unnamedParam1
A pointer to an OLEUIPASTESPECIAL structure.
Return value
Standard Success/Error Definitions
Return code | Description |
---|---|
|
Unknown failure (unused). |
|
The user pressed the OK button. |
|
No error, same as OLEUI_OK. |
|
The user pressed the Cancel button. |
Standard Field Validation Errors
Return code | Description |
---|---|
|
Errors common to all dialog boxes lie in the range OLEUI_ERR_STANDARDMIN to OLEUI_ERR_STANDARDMAX. This value allows the application to test for standard messages in order to display error messages to the user. |
|
The pointer to an OLEUIXXX structure passed into the function was NULL. |
|
Insufficient permissions for read or write access to an OLEUIXXX structure. |
|
The cbstruct value is incorrect. |
|
The hWndOwner value is invalid. |
|
The lpszCaption value is invalid. |
|
The lpfnHook value is invalid. |
|
The hInstance value is invalid. |
|
The lpszTemplate value is invalid. |
|
The hResource value is invalid. |
Initialization Errors
Return code | Description |
---|---|
|
Unable to find the dialog box template. |
|
Unable to load the dialog box template. |
|
Dialog box initialization failed. |
|
A call to LocalAlloc or the standard IMalloc allocator failed. |
|
A call to GlobalAlloc or the standard IMalloc allocator failed. |
|
Unable to call LoadString to get localized resources from the library. |
|
A call to the standard IMalloc allocator failed. |
Function Specific Errors
Return code | Description |
---|---|
|
Errors common to all dialog boxes lie in the range OLEUI_ERR_STANDARDMIN to OLEUI_ERR_STANDARDMAX. This value allows the application to test for standard messages in order to display error messages to the user. |
|
The lpSrcDataObject member of OLEUIPASTESPECIAL is invalid. |
|
The arrPasteEntries member of OLEUIPASTESPECIAL is invalid. |
|
The arrLinkTypes member of OLEUIPASTESPECIAL is invalid. |
|
The clipboard contents changed while the dialog box was displayed. |
|
The lpSrcDataObj member is incorrect. |
Remarks
The design of the Paste Special dialog box assumes that if you are willing to permit a user to link to an object, you are also willing to permit the user to embed that object. For this reason, if any of the OLEUIPASTE_LINKTYPE flags associated with the OLEUIPASTEFLAG enumeration are set, then the OLEUIPASTE_PASTE flag must also be set in order for the data formats to appear in the Paste Special dialog box.
The text displayed in the Source field of the standard Paste Special dialog box, which is implemented in Oledlg32.dll, is the null-terminated string whose offset in bytes is specified in the dwSrcofCopy member of the OBJECTDESCRIPTOR structure for the object to be pasted. If an OBJECTDESCRIPTOR structure is not available for this object, the dialog box displays whatever text may be associated with CF_LINKSOURCEDESCRIPTOR. If neither structure is available, the dialog box looks for CF_FILENAME. If CF_FILENAME is not found, the dialog box displays the string "Unknown Source".
To free an HMETAFILEPICT returned from the Insert Object or Paste Special dialog box, delete the attached metafile on the handle, as follows.
void FreeHmetafilepict(HMETAFILEPICT hmfp)
{
if (hmfp != NULL)
{
LPMETAFILEPICT pmfp = GlobalLock(hmfp);
DeleteMetaFile(pmfp->hMF);
GlobalUnlock(hmfp);
GlobalFree(hmfp);
}
else
{
// Handle null pointers here.
exit(0);
}
}
Note
The oledlg.h header defines OLEUIPASTESPECIAL as an alias that automatically selects the ANSI or Unicode version of this function based on the definition of the UNICODE preprocessor constant. Mixing usage of the encoding-neutral alias with code that is not encoding-neutral can lead to mismatches that result in compilation or runtime errors. For more information, see Conventions for Function Prototypes.
Requirements
Requirement | Value |
---|---|
Minimum supported client | Windows 2000 Professional [desktop apps only] |
Minimum supported server | Windows 2000 Server [desktop apps only] |
Target Platform | Windows |
Header | oledlg.h |
Library | OleDlg.lib |
DLL | OleDlg.dll |