|
-
Jan 30th, 2002, 11:11 AM
#1
Thread Starter
Member
Paste clipboard to ANY application?
HI,
There's a piece of code I can't get to work for the macro recorder I'm writing. I want to copy text to any application that has the focus. The implementation that sent separate keystrokes didn't work, just took too much time to execute. So, I wrote some code that sends the text like 'copy-paste' from the clipboard.
The code is executed during a keyboard event hook and somehow that causes all VB calls (like "SendKeys") to crash. So, all calls are made through win32 API.
Code:
Case TYPE_TEXT
Clipboard.Clear
Clipboard.SetText aMacro.data, vbCFText
' SendKeys "^V", 1
Windows_Control.sendKeyDown vbKeyControl
Windows_Control.sendKeyDown vbKeyV
Windows_Control.sendKeyUp vbKeyControl
Windows_Control.sendKeyUp vbKeyV
This code works fine.... the first time.
The second time, all texts are replaced by the last one I placed on the clipboard.
Example, the macro that sends (each line separate event):
test1
test2
test3
ends up like:
test3
test3
test3
Someone here at the office suggested that Windows has multiple clipboards, but would that be true? What could be the solution for this problem?
If someone can give me a lead, I'd appreciate it. A piece of code, too.
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
|