'How do I know when my Ctrl + C command has been processed?

I need to copy the currently selected text from the currently active window in the currently active app. If the app support guiInfo.hwndCaret, then I use this. However, in some cases, the app does not support guiInfo.hwnd_Caret, and I have to fall back to plain copying to clipboard to get the currently selected text.

I am checking the WM_DRAWCLIPBOARD message to see when the content of the clipboard has changed.

However, when nothing is selected in the current active window, this message is not called because the clipboard has not changed.

How would I know that the Ctrl + C has been processed anyways?

Thank you!



Solution 1:[1]

From MSDN

Each time the contents of the clipboard change, a 32-bit value known as the clipboard sequence number is incremented. A program can retrieve the current clipboard sequence number by calling the GetClipboardSequenceNumber function. By comparing the value returned against a value returned by a previous call to GetClipboardSequenceNumber, a program can determine whether the clipboard contents have changed.

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Anders