|
-
Apr 22nd, 2022, 09:10 AM
#1
Thread Starter
Fanatic Member
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!
-
Apr 22nd, 2022, 03:23 PM
#2
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.
-
Apr 22nd, 2022, 03:24 PM
#3
Thread Starter
Fanatic Member
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.
-
Apr 22nd, 2022, 03:35 PM
#4
Re: How do I know when my Ctrl + C command has been processed?
 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).
-
Apr 22nd, 2022, 05:39 PM
#5
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.
Last edited by fafalone; Apr 22nd, 2022 at 06:34 PM.
-
Apr 23rd, 2022, 08:00 AM
#6
Thread Starter
Fanatic Member
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.
Tags for this Thread
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|