监 控 剪 切 板 的 几 个 windows API函 数 (1)系 统 提 供 了 WM_DRAWCLIPBOARD消 息 用 于 监 视 剪 切 板 的 变 化
如果调用 SetClipboardViewer函数 设置了 窗口为剪 切 板 查看器,那么当剪 切 板 内容变 化 时,所注册的 查看器窗口会收到WM_CHANGECBCHAIN消 息 和 WM_DRAWCLIPBOARD消 息
当剪 切 板 中的 内容变 化 时,窗口会收到 WM_DRAWCLIPBOARD消 息
当查看器链表中有新的 节点加入或有节点 退出窗口会收到 WM_CHANGECBCHAIN消 息 (2)SetClipboardViewer HWND SetClipboardViewer( HWND hWndNewViewer ); hWndNewViewer指定了 监 视 窗口 另外还有(msdn中都有): 获取剪 切 板 中格式的 API函 数 int GetPriorityClipboardFormat( UINT* paFormatPriorityList, int cFormats ); 函 数 的 检测功能是检测剪 切 板 中是否有特定格式的 数 据
CountClipboardFormats函 数 返回当前剪 切 板 中具有的 不同格式的 数 量 int CountClipboardFormats(void); EnumClipboardFormats枚举当前剪 切 板 中的 所有格式 UINT EnumClipboardFormats( UINT format ); GetUpdatedClipboardFormats函 数 获取当前剪 切 板 所有格式 BOOL GetUpdatedClipboardFormats( PUINT lpuiFormats, UINT cF