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_CLIPBOARDUPDATE 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!
Re: How do I know when my Ctrl + C command has been processed?
You don't know when other apps read the clipboard.
I think you need a better way to communicate programs. Using the clipboard is a bad idea anyway.
Re: How do I know when my Ctrl + C command has been processed?
I have not found any other way to copy the selected text from chrome.exe.
Re: How do I know when my Ctrl + C command has been processed?
Quote:
Originally Posted by
tmighty2
I have not found any other way to copy the selected text from chrome.exe.
Better describe exactly what you are trying to achieve, maybe we can have an idea (or not).
Re: How do I know when my Ctrl + C command has been processed?
Did you read my comment in the other thread about this?
You don't need a pause, doevents, or loop.
Pseudocode:
Code:
bExpectingCopy As Boolean
Dim lSent As Long, lReceived As Long
Sub that sends CtrlC:
GetTickCount lSent
bExpectingCopy = True
SendCtrlC
SubclassProc:
Case WM_CLIPBOARDUPDATE
If bExpectingCopy Then
GetTickCount lReceived
If lReceived - lSent < 100 Then
You're only here if text was copied.
Re: How do I know when my Ctrl + C command has been processed?
Yes, I did read it, thank you.
I have isolated my problem now, and the real issue is that there is no event if Ctrl + C was processed, but the clipboard was not changed because the selection was empty.
There is no solution to this problem, so I use a timer (similar to what you proposed with GetTickCount), and after a certain elapsed amount of time without this window message, I assume that the selection was indeed empty.