网站首页  词典首页

请输入您要查询的函数:

 

术语 setclipboarddata
释义 SetClipboardData
语法:
HANDLE SetClipboardData( UINT uFormat,
HANDLE hMem
);
SetClipboardData函数
该SetClipboardData函数的地方就在指定的剪贴板格式的剪贴板数据。该窗口必须是当前剪贴板所有者,应用程序必须有所谓的OpenClipboard函数。 (当响应WM_RENDERFORMAT和WM_RENDERALLFORMATS消息,剪贴板的所有者必须不调用之前调用SetClipboardData OpenClipboard。)
参数
uFormat
[in]指定剪贴板格式。此参数可以是一个注册的格式或标准的剪贴板格式的。有关更多信息,请注册剪贴板格式和标准剪贴板格式。
hMem
[in]句柄指定格式的数据。此参数可以为NULL,表明该窗口提供要求在指定的剪贴板格式的数据(呈现格式)。如果窗口延迟渲染,它必须处理WM_RENDERFORMAT和WM_RENDERALLFORMATS消息。
如果SetClipboardData成功,该系统拥有的hMem参数确定的对象。应用程序可能无法写入或释放一次数据的所有权已经转移到系统,但它可以锁定并读取到的数据CloseClipboard函数调用。 (该内存必须上锁剪贴板前关闭。如果hMem参数标识一个内存对象),该对象必须已分配使用的GMEM_MOVEABLE标志的功能。
返回值
如果函数成功,返回值是处理的数据。
如果函数失败,返回值为NULL。为了获得更多错误信息,调用GetLastError。
备注
该uFormat参数可以识别注册剪贴板格式,也可以是标准的剪贴板格式之一。有关更多信息,请注册剪贴板格式和标准剪贴板格式。
如果一个应用程序调用响应WM_RENDERFORMAT或WM_RENDERALLFORMATS SetClipboardData,应用程序不应使用处理后SetClipboardData被称为。
如果一个应用程序调用hwnd设置为NULL OpenClipboard,EmptyClipboard设置为NULL剪贴板人;这将导致SetClipboardData失败。
该系统隐式数据执行某些剪贴板格式之间的格式转换时,应用程序调用GetClipboardData函数。例如,如果CF_OEMTEXT格式剪贴板是一个窗口,可以检索的CF_TEXT格式的数据。关于剪贴板格式转换为按需请求的格式。有关更多信息,请参阅合成剪贴板格式。
例如
有关示例,请参见信息复制到剪贴板。
功能信息
最低DLL版本 user32.dll
在Winuser.h中HeaderDeclared,头文件:winuser.h
import libraryUser32.lib
最低操作系统Windows 95,Windows NT 3.1
参见
剪贴板,CloseClipboard,GetClipboardData,OpenClipboard,RegisterClipboardFormat,WM_RENDERFORMAT,WM_RENDERALLFORMATS
==英文原文==SetClipboardData Function
The SetClipboardData function places data on the clipboard in a specified clipboard format. The window must be the current clipboard owner, and the application must have called the OpenClipboard function. (When responding to the WM_RENDERFORMAT and WM_RENDERALLFORMATS messages, the clipboard owner must not call OpenClipboard before calling SetClipboardData.)
Syntax
HANDLE SetClipboardData( UINT uFormat,
HANDLE hMem
);
Parameters
uFormat
[in] Specifies a clipboard format. This parameter can be a registered format or any of the standard clipboard formats. For more information, see Registered Clipboard Formats and Standard Clipboard Formats .
hMem
[in] Handle to the data in the specified format. This parameter can be NULL, indicating that the window provides data in the specified clipboard format (renders the format) upon request. If a window delays rendering, it must process the WM_RENDERFORMAT and WM_RENDERALLFORMATS messages.
If SetClipboardData succeeds, the system owns the object identified by the hMem parameter. The application may not write to or free the data once ownership has been transferred to the system, but it can lock and read from the data until the CloseClipboard function is called. (The memory must be unlocked before the Clipboard is closed.) If the hMem parameter identifies a memory object, the object must have been allocated using the function with the GMEM_MOVEABLE flag.
Return Value
If the function succeeds, the return value is the handle to the data.
If the function fails, the return value is NULL. To get extended error information, call GetLastError .
Remarks
The uFormat parameter can identify a registered clipboard format, or it can be one of the standard clipboard formats. For more information, see Registered Clipboard Formats and Standard Clipboard Formats.
If an application calls SetClipboardData in response to WM_RENDERFORMAT or WM_RENDERALLFORMATS, the application should not use the handle after SetClipboardData has been called.
If an application calls OpenClipboard with hwnd set to NULL, EmptyClipboard sets the clipboard owner to NULL; this causes SetClipboardData to fail.
The system performs implicit data format conversions between certain clipboard formats when an application calls the GetClipboardData function. For example, if the CF_OEMTEXT format is on the clipboard, a window can retrieve data in the CF_TEXT format. The format on the clipboard is converted to the requested format on demand. For more information, see Synthesized Clipboard Formats .
Example
For an example, see Copying Information to the Clipboard .
Function Information
Minimum DLL Versionuser32.dll
HeaderDeclared in Winuser.h, include Windows.h
Import libraryUser32.lib
Minimum operating systemsWindows 95, Windows NT 3.1
See Also
Clipboard , CloseClipboard , GetClipboardData , OpenClipboard , RegisterClipboardFormat , WM_RENDERFORMAT , WM_RENDERALLFORMATS
==原始网址==http://msdn.microsoft.com/en-us/library/ms649051(VS.85).aspx\n
随便看

 

windows api函数参考手册包含2258条windows api函数文档,详细介绍nodejs、java、rust调用windows api的方法技巧,是学习windows api编程的入门中文文档。

 

Copyright © 2004-2023 Winrtm.com All Rights Reserved
京ICP备2021023879号-40 更新时间:2024/10/6 13:16:28