Results 1 to 6 of 6

Thread: [RESOLVED] [2005] Clearing clipboard after paste

  1. #1

    Thread Starter
    Frenzied Member
    Join Date
    Jun 2005
    Posts
    1,950

    Resolved [RESOLVED] [2005] Clearing clipboard after paste

    I have an app where I allow the user to copy some data onto the clipboard, so that it can be dropped onto a text form or maybe a login form etc.

    Is there a way that I can clear the clipboard after the data is pasted? So I effectively want to allow a 'paste once'. To do this I would need to detect if a paste event has occurred somewhere on the users desktop/computer. (Detecting a mouse up/down is not specific enough). Maybe I need to detect a CTRL-V too.

    Is this possible?

  2. #2
    Frenzied Member stimbo's Avatar
    Join Date
    Jun 2006
    Location
    UK
    Posts
    1,739

    Re: [2005] Clearing clipboard after paste

    I haven't tried it but does this work or something similar? Just add it after the 1st paste or something.

    vb Code:
    1. My.Computer.Clipboard.Clear()
    Stim

    Free VB.NET Book Chapter
    Visual Basic 2005 Cookbook Sample Chapter

  3. #3

    Thread Starter
    Frenzied Member
    Join Date
    Jun 2005
    Posts
    1,950

    Re: [2005] Clearing clipboard after paste

    That is how I would clear the clipboard. It is detecting a 'paste event' that I am uncertain about.

  4. #4

    Thread Starter
    Frenzied Member
    Join Date
    Jun 2005
    Posts
    1,950

    Re: [2005] Clearing clipboard after paste

    Can I detect the keyboard and mouse activity when the app is not focussed?

  5. #5
    Frenzied Member
    Join Date
    Mar 2006
    Location
    Pennsylvania
    Posts
    1,069

    Re: [2005] Clearing clipboard after paste

    Yea. With a keyboard and mouse hook.

    http://www.codeproject.com/csharp/globalhook.asp

    Download the source files at that page.

    It's C# but should be easy to convert.

  6. #6

    Thread Starter
    Frenzied Member
    Join Date
    Jun 2005
    Posts
    1,950

    Re: [2005] Clearing clipboard after paste

    ok, perfect, I'll give it a go.

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