|
-
Oct 26th, 2004, 08:42 PM
#1
Thread Starter
Junior Member
VB6 Clipboard
I been wondering how to make my vb6 form run in sync with the windows clipboard, so if someone copies something off of a web page for example, it will automatically insert into my form if I have it up.
Last edited by Kinzer; Oct 27th, 2004 at 06:11 PM.
-
Oct 26th, 2004, 08:58 PM
#2
Make a timer which will periodically (like every 200 miliseconds) read the clipboard
-
Oct 26th, 2004, 09:06 PM
#3
Thread Starter
Junior Member
That would work great, but I also wanted to be able to keep up everything that is copied, instead of acting like the windows clipboard.
So if I copied 5 different things at 5 different times, they all show in order in a textbox. Get the concept? (I hope, it's confusing me
-
Oct 26th, 2004, 09:20 PM
#4
Make on textbox that acts as the main storage, and make one that will act as a buffer. Like txtData and txtBuffer, and make the timer read the clipboard into the txtBuffer, and then put the code:
txtData.Text = txtData.Text & vbcrlf & txtBuffer.Text
in the txtBuffer_Change sub
that way, only if the data is different it will be copied into the storage textbox
-
Oct 26th, 2004, 09:37 PM
#5
Thread Starter
Junior Member
Originally posted by baja_yu
Make on textbox that acts as the main storage, and make one that will act as a buffer. Like txtData and txtBuffer, and make the timer read the clipboard into the txtBuffer, and then put the code:
txtData.Text = txtData.Text & vbcrlf & txtBuffer.Text
in the txtBuffer_Change sub
that way, only if the data is different it will be copied into the storage textbox
Actually, right after I posted my second post, I thought of that. So I tried it. It works out great! But of course, I ran into another problem now. It only works if the text that I copy changes. But in some cases, the text that I'll be copying will be the same =/ I can copy the statement "You are teh winnah" and it will put it in the storage textbox. Then I copy it again, and it does nothing (obviously because there is no change). Thanks for all your help, it is much appreciated.
-
Oct 26th, 2004, 10:10 PM
#6
That is ture, but if you already have it once, why would you need it again?
-
Oct 27th, 2004, 12:11 AM
#7
just add a counter to the front of it, and then paste it
This
2 This
3 2 This
or check to see if they are the same, and then add the counter to the saved value before pasting it, and the count will be different
This
2 This
3 This
That
-
Oct 27th, 2004, 12:23 AM
#8
One way is to clear the clipboard in the timer (after you get its data) but then you will loose functionality of the clipboard (it will always get emptied...
-
Oct 27th, 2004, 05:41 PM
#9
Thread Starter
Junior Member
So then I must find another method of going about trying to do what I want. Trial and error I suppose, thanks everyone
-
Oct 27th, 2004, 06:10 PM
#10
Thread Starter
Junior Member
Well, I'm happy to say that I figured it out. The timer that adds the buffer box to the storage box is the key. After it added it's information, I had it set the clipboard to "" as well as the buffer box. Then in the bufferbox_change statement I threw in an If Then statement that said if bufferbox = "" then basicly do nothing. It's working 100% right now, thanks for all your much needed help
-
Oct 28th, 2004, 12:08 AM
#11
That is exactly what I said in my last post. But arent you loosing functionality of the clipboard that way? If the user copies anything you app grabs it and empties the clipboard (withing 200-300 ms, what ever you set the timer to) so when user tries to paste it, the clipboard will be empty.
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
|