【お知らせ】この部分は英語原文のみでの提供となります。何卒ご了承ください。
2.1.25.65 OpenClipboard
Contents
Description
Opens the clipboard for examination and prevents other applications from modifying the clipboard content.
Syntax
BOOL OpenClipboard( HWND hWndNewOwner )
Parameters
- hWndNewOwner
- [input] Handle to the window to be associated with the open clipboard. If this parameter is NULL, the open clipboard is associated with the current task.
Return
Returns TRUE on successful exit and FALSE on error.
Examples
EX1
int OpenClipboard_ex1() { if(!OpenClipboard(NULL)) return 0; if(IsClipboardFormatAvailable(CF_TEXT)) { HANDLE hData = GetClipboardData(CF_TEXT); LPCSTR lpData = (LPCSTR)GlobalLock(hData); string str = lpData; GlobalUnlock(hData); out_str(str); } else out_str("No Text in clipboard"); CloseClipboard(); return 1; }
Remark
This function opens the clipboard for examination and prevents other applications from modifying the clipboard content. .
OpenClipboard fails if another window has the clipboard open.
An application should call the CloseClipboard function after every successful call to OpenClipboard.
The window identified by the hWndNewOwner parameter does not become the clipboard owner unless the EmptyClipboard function is called.
See Also
Header to Include
origin.h