Opens the clipboard for examination and prevents other applications from modifying the clipboard content.
BOOL OpenClipboard( HWND hWndNewOwner )
Returns TRUE on successful exit and FALSE on error.
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; }
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.
CloseClipboard
origin.h