Clipboard change notification?

前端 未结 4 1681
感情败类
感情败类 2020-12-24 03:09

I know how put content to and retrieve content from the clipboard.

However, between these two operations, it is possible for another operation to change the content

4条回答
  •  天命终不由人
    2020-12-24 04:06

    However, between these two operations, it is possible for another operation to change the content of the clipboard.

    When an application calls OpenClipboard(), no other application can use the clipboard. Once the application that has locked the clipboard calls CloseClipboard(), then any application can then use and lock the clipboard.

    Is there a way to be notified when any application modifies the clipboard?

    Yes. See the API SetClipboardViewer() and the messages WM_DRAWCLIPBOARD and WM_CHANGECBCHAIN.

    More info here: http://msdn.microsoft.com/en-us/library/ms649016(v=vs.85).aspx#_win32_Adding_a_Window_to_the_Clipboard_Viewer_Chain

提交回复
热议问题