Groups search result 1 for ChangeClipboardChain SetClipboardViewer "MS DOCS" From: danny_pav (danny_pav@geocities.com) Search Result 1 Subject: Re: Clipboard: Catching a paste to clipboard Newsgroups: microsoft.public.vc.mfc Date: 1999/03/17 View: Complete Thread (7 articles) | Original Format In article <01be6fed$261e3a00$4592a6c3@agd>, "gilleptic" wrote: > Hi, > > Is it possible to catch any application putting text in the clipboard? > > Thanks, > > USE THESE: FROM MS DOCS: SetClipboardViewer The SetClipboardViewer function adds the specified window to the chain of clipboard viewers. Clipboard viewer windows receive a WM_DRAWCLIPBOARD message whenever the content of the clipboard changes. HWND SetClipboardViewer( HWND hWndNewViewer // handle to clipboard viewer window ); Parameters hWndNewViewer Handle to the window to be added to the clipboard chain. Return Values If the function succeeds, the return value identifies the next window in the clipboard viewer chain. If an error occurs or there are no other windows in the clipboard viewer chain, the return value is NULL. To get extended error information, call GetLastError. Remarks The windows that are part of the clipboard viewer chain, called clipboard viewer windows, must process the clipboard messages WM_CHANGECBCHAIN and WM_DRAWCLIPBOARD. Each clipboard viewer window calls theSendMessage function to pass these messages to the next window in the clipboard viewer chain. A clipboard viewer window must eventually remove itself from the clipboard viewer chain by calling the ChangeClipboardChain function - for example, in response to theWM_DESTROY message. and ChangeClipboardChain The ChangeClipboardChain function removes a specified window from the chain of clipboard viewers. BOOL ChangeClipboardChain( HWND hWndRemove, // handle to window to remove HWND hWndNewNext // handle to next window ); Parameters hWndRemove Handle to the window to be removed from the chain. The handle must have been passed to the SetClipboardViewer function. hWndNewNext Handle to the window that follows the hWndRemove window in the clipboard viewer chain. (This is the handle returned by SetClipboardViewer, unless the sequence was changed in response to a WM_CHANGECBCHAIN message.) Return Values The return value indicates the result of passing the WM_CHANGECBCHAIN message to the windows in the clipboard viewer chain. Because a window in the chain typically returns FALSE when it processes WM_CHANGECBCHAIN, the return value from ChangeClipboardChain is typically FALSE. If there is only one window in the chain, the return value is typically TRUE. Remarks The window identified by hWndNewNext replaces the hWndRemove window in the chain. The SetClipboardViewer function sends a WM_CHANGECBCHAIN message to the first window in the clipboard viewer chain. This should get you started. Danny -----------== Posted via Deja News, The Discussion Network ==---------- http://www.dejanews.com/ Search, Read, Discuss, or Start Your Own