OpenClipboard Function
The OpenClipboard function opens the clipboard for the current thread and empties the clipboard.
Syntax
BOOL OpenClipboard(
HWND hWndNewOwner
);
Parameters
Parameter | Description |
---|---|
hWndNewOwner |
A handle to the window that will be the new owner of the clipboard. If this parameter is NULL , the current task opens the clipboard. |
Return Value
If the function succeeds, the return value is TRUE. If the function fails, the return value is FALSE. To get extended error information, call GetLastError
.
Remarks
An application must call OpenClipboard before it can perform any operations on the clipboard, such as setting or getting data.
An application should call CloseClipboard when it is finished with the clipboard. If an application calls OpenClipboard without calling CloseClipboard, other applications will not be able to access the clipboard.
There is only one clipboard for each thread. If hWndNewOwner
specifies a window that is currently associated with the clipboard, OpenClipboard returns TRUE and empties the clipboard.
The system automatically closes the clipboard for a thread if that thread terminates.
Note
Applications should not call OpenClipboard more than once without calling CloseClipboard between each call. Doing so will cause the function to return FALSE.
Requirements
SDK | |
---|---|
Minimum supported client | Windows 2000 Professional |
Minimum supported server | Windows 2000 Server |
Header | winuser.h (include Windows.h) |
Library | User32.lib |
DLL | User32.dll |