Page 1 of 2 12 LastLast
Results 1 to 15 of 19
  1. #1
    2 Star Lounger
    Join Date
    Sep 2002
    Posts
    180
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Preventing clipboard copies outside document (XP/2000)

    Hi. I have an application which enables people to edit confidential documents. Does anybody know of a way to prevent someone from copying/cutting something and then pasting it to a destination outside the current document?

  2. #2
    Super Moderator jscher2000's Avatar
    Join Date
    Feb 2001
    Location
    Silicon Valley, USA
    Posts
    23,112
    Thanks
    5
    Thanked 93 Times in 89 Posts

    Re: Preventing clipboard copies outside document (XP/2000)

    Word lets you override certain built-in commands by name (e.g., EditCut, EditCopy) by creating a macro with that identical name (i.e., a macro that does nothing). Macros can be defeated with security settings, so it's certainly not failsafe.

    You also can hide, defeat, or redefine menu and toolbar settings, but these can be reset and they are more complex to program.

    So, in short, you can make it inconvenient, but a determined person can do it.

  3. #3
    2 Star Lounger
    Join Date
    Feb 2001
    Location
    Wellington, New Zealand
    Posts
    143
    Thanks
    0
    Thanked 1 Time in 1 Post

    Re: Preventing clipboard copies outside document (

    If what you're trying to do is critical, you may want to have a look at Word 2003. It's meant to have a lot of new security and privacy features.

  4. #4
    Super Moderator
    Join Date
    Jan 2001
    Location
    Melbourne, Victoria, Australia
    Posts
    3,852
    Thanks
    4
    Thanked 259 Times in 239 Posts

    Re: Preventing clipboard copies outside document (XP/2000)

    I agree with the boys that you can protect a Word document only so much but determined hackers or power users can easily circumvent the security you create. Possibly Word 2003 has the new security features right but I wouldn't hold my breath.

    You could possibly hijack the WindowLostFocus event (I'm assuming something like this exists) to empty the clipboard but this would only stop ~90% of users.

    ** Shameless Plug Filter On **
    A possible hardware solution does exist - Tenix (a company I regularly work for) has created a piece of hardware that allows one PC to access files on both a secured (ie confidential) network and an unsecured network. This 'data diode' allows people to have multiple windows running and data can be copied from the low side to the high side but not the other way. Here is a link to a web page where Tenix provides some high level information on this Veto product.

    The commercial version of this software is aimed at sites where some data needs to be completely secured by separate networks but the site doesn't want to pay for 2 PCs for each person who needs to work on secure data but still wants email, internet etc.
    ** Shameless Plug Filter Off **
    Andrew Lockton, Chrysalis Design, Melbourne Australia

  5. #5
    2 Star Lounger
    Join Date
    Sep 2002
    Posts
    180
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Preventing clipboard copies outside document (XP/2000)

    I'm interested in the override approach. If I defined "EditCopy" in an addin that got loaded with my app, would that then override Word's "EditCopy"?

    Thanks a lot for your help....

    Dan

  6. #6
    Super Moderator
    Join Date
    Dec 2000
    Location
    Renton, Washington, USA
    Posts
    12,560
    Thanks
    0
    Thanked 4 Times in 4 Posts

    Re: Preventing clipboard copies outside document (XP/2000)

    Is this protection for internal use only or will it be passed on to some one outside the company?

    Now running HP Pavilion a6528p, with Win7 64 Bit OS.

  7. #7
    2 Star Lounger
    Join Date
    Sep 2002
    Posts
    180
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Preventing clipboard copies outside document (XP/2000)

    I'm not sure I understand your question.

  8. #8
    Super Moderator jscher2000's Avatar
    Join Date
    Feb 2001
    Location
    Silicon Valley, USA
    Posts
    23,112
    Thanks
    5
    Thanked 93 Times in 89 Posts

    Re: Preventing clipboard copies outside document (XP/2000)

    It should. Word should respond to Edit>Copy or Ctrl+C by running the code in your EditCopy() procedure. Give it a try.

    Note that "local trumps global," so if the document or document template has its own EditCopy() procedure, that will run instead of your global procedure.

  9. #9
    2 Star Lounger
    Join Date
    Sep 2002
    Posts
    180
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Preventing clipboard copies outside document (XP/2000)

    Thanks. Yes it appears to work. Is there a way to list all of these builtin commands?

    Also--do you know how to clear the clipboard from VBA in Word?

  10. #10
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: Preventing clipboard copies outside document (XP/2000)

    You can download an Excel spreadsheet or PDF file with Word for Windows Commands from the Word MVP site.

  11. #11
    Super Moderator jscher2000's Avatar
    Join Date
    Feb 2001
    Location
    Silicon Valley, USA
    Posts
    23,112
    Thanks
    5
    Thanked 93 Times in 89 Posts

    Re: Preventing clipboard copies outside document (XP/2000)

    I don't know how to clear the Windows clipboard without using the Windows API. (And I'd have to run a search for that one!) One thought is that you might be able to clear the items on the clipboard toolbar, but I don't know if that would clear the Windows clipboard.

  12. #12
    2 Star Lounger
    Join Date
    Sep 2002
    Posts
    180
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Preventing clipboard copies outside document (XP/2000)

    I just found an article and some downloadable code by Karl Peterson at:

    <http://www.fawcette.com/archives/listissue.asp?pubID=1&MagIssueId=396#>

    It uses the Windows API, as you suggested. I'd gone all this time without needing to learn the inner workings of the clipboard. They finally caught up with me...

  13. #13
    2 Star Lounger
    Join Date
    Sep 2002
    Posts
    180
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Preventing clipboard copies outside document (XP/2000)

    Here's how to do it:

    Private Declare Function OpenClipboard Lib "user32" (ByVal hWnd As Long) As Long
    Private Declare Function CloseClipboard Lib "user32" () As Long
    Private Declare Function EmptyClipboard Lib "user32" () As Long

    Public Function Clear() As Boolean
    ' Clear the clipboard of all content. (Same
    ' behavior as standard VB Clipboard object.)
    If OpenClipboard(0&) Then
    Clear = CBool(EmptyClipboard)
    Call CloseClipboard
    End If
    End Function

  14. #14
    Plutonium Lounger
    Join Date
    Nov 2001
    Posts
    10,550
    Thanks
    0
    Thanked 7 Times in 7 Posts

    Re: Preventing clipboard copies outside document (XP/2000)

    The easiest way must be to copy or cut something to it, maybe a single space or something similar.

    StuartR

  15. #15
    2 Star Lounger
    Join Date
    Sep 2002
    Posts
    180
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Preventing clipboard copies outside document (XP/2000)

    Is there a way to intercept a builtin command and then, if necessary, pass it back on to the original builtin command?

Page 1 of 2 12 LastLast

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •