Results 1 to 11 of 11

Thread: VB6 Clipboard

  1. #1

    Thread Starter
    Junior Member
    Join Date
    Oct 2004
    Posts
    18

    Resolved 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.

  2. #2
    Next Of Kin baja_yu's Avatar
    Join Date
    Aug 2002
    Location
    /dev/root
    Posts
    5,989
    Make a timer which will periodically (like every 200 miliseconds) read the clipboard

  3. #3

    Thread Starter
    Junior Member
    Join Date
    Oct 2004
    Posts
    18
    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

  4. #4
    Next Of Kin baja_yu's Avatar
    Join Date
    Aug 2002
    Location
    /dev/root
    Posts
    5,989
    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

  5. #5

    Thread Starter
    Junior Member
    Join Date
    Oct 2004
    Posts
    18
    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.

  6. #6
    Next Of Kin baja_yu's Avatar
    Join Date
    Aug 2002
    Location
    /dev/root
    Posts
    5,989
    That is ture, but if you already have it once, why would you need it again?

  7. #7
    Banned dglienna's Avatar
    Join Date
    Jun 2004
    Location
    Center of it all
    Posts
    17,901
    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

  8. #8
    Next Of Kin baja_yu's Avatar
    Join Date
    Aug 2002
    Location
    /dev/root
    Posts
    5,989
    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...

  9. #9

    Thread Starter
    Junior Member
    Join Date
    Oct 2004
    Posts
    18
    So then I must find another method of going about trying to do what I want. Trial and error I suppose, thanks everyone

  10. #10

    Thread Starter
    Junior Member
    Join Date
    Oct 2004
    Posts
    18
    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

  11. #11
    Next Of Kin baja_yu's Avatar
    Join Date
    Aug 2002
    Location
    /dev/root
    Posts
    5,989
    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
  •  



Click Here to Expand Forum to Full Width