Prevent other applications from accesing the Clipboard.

This is a discussion on Prevent other applications from accesing the Clipboard. within the Windows Programming forums, part of the Platform Specific Boards category; Does anybody know a way to do such thing? I assume there's some API functions. Thanks!...

  1. #1
    Registered User
    Join Date
    Oct 2007
    Posts
    242

    Prevent other applications from accesing the Clipboard.

    Does anybody know a way to do such thing? I assume there's some API functions.
    Thanks!

  2. #2
    C++まいる!Cをこわせ! Elysia's Avatar
    Join Date
    Oct 2007
    Posts
    22,449
    Why?
    Quote Originally Posted by Adak View Post
    io.h certainly IS included in some modern compilers. It is no longer part of the standard for C, but it is nevertheless, included in the very latest Pelles C versions.
    Quote Originally Posted by Salem View Post
    You mean it's included as a crutch to help ancient programmers limp along without them having to relearn too much.

    Outside of your DOS world, your header file is meaningless.

  3. #3
    Registered User
    Join Date
    Oct 2007
    Posts
    242
    Quote Originally Posted by Elysia View Post
    Why?
    A friend gave me 2 programs he created:
    One program (msnmsgr.exe, the first one) uses CreateProcess to the other one which is (svchost.exe, another program he created) and this program open the clipboard and writes a string using SetClipboardData while(1).
    Now I am supposed to gain back the access to the clipboard (Note that he is using familiar program names, it might be a hint)

  4. #4
    and the hat of sweating
    Join Date
    Aug 2007
    Location
    Toronto, ON
    Posts
    3,545
    Quote Originally Posted by eXeCuTeR View Post
    A friend gave me 2 programs he created:
    One program (msnmsgr.exe, the first one) uses CreateProcess to the other one which is (svchost.exe, another program he created) and this program open the clipboard and writes a string using SetClipboardData while(1).
    Now I am supposed to gain back the access to the clipboard (Note that he is using familiar program names, it might be a hint)
    Is your friend's name "Bill Gates"?
    The first one is MSN Messenger and the second is a Windows service program (well unless he just used the same names as those programs).

  5. #5
    Confused Magos's Avatar
    Join Date
    Sep 2001
    Location
    Sweden
    Posts
    3,145
    The entire point of the clipboard is so multiple programs have access to shared memory. If you want no others to access it, find other means of whatever you're trying to do.
    MagosX.com

    Give a man a fish and you feed him for a day.
    Teach a man to fish and you feed him for a lifetime.

  6. #6
    Registered User
    Join Date
    Oct 2007
    Posts
    242
    Quote Originally Posted by cpjust View Post
    Is your friend's name "Bill Gates"?
    The first one is MSN Messenger and the second is a Windows service program (well unless he just used the same names as those programs).
    I mentioned that he used these names for the names of the program.
    And yeah, I'm trying to make that no other application will be able to write to the clipboard.
    Last edited by eXeCuTeR; 07-26-2008 at 07:33 PM.

  7. #7
    CSharpener vart's Avatar
    Join Date
    Oct 2006
    Location
    Rishon LeZion, Israel
    Posts
    6,473
    I'm trying to make that no other application will be able to write to the clipboard
    This isn't a board for virus creation discussions
    The first 90% of a project takes 90% of the time,
    the last 10% takes the other 90% of the time.

  8. #8
    Registered User
    Join Date
    Mar 2005
    Location
    Mountaintop, Pa
    Posts
    1,059
    The clipboard is actually a chain of windows referred to as the clipboard viewer chain. If you wish to bypass any/all windows in this chain, you will have to add your GUI's app to the head of this chain. Your app can then choose not to pass this information down the chain or choose a starting window to pass the information down the chain. In other words, the app can choose to pass the information down the chain starting at the fourth window in the chain and going down the chain from that point. You must remove your GUI's window from the chain prior to terminating your app. Otherwise, the consequences will be extremely unpredicatable. An example.

  9. #9
    C++まいる!Cをこわせ! Elysia's Avatar
    Join Date
    Oct 2007
    Posts
    22,449
    Don't feed the trolls.
    It's actually quite easy to block other apps from using the clipboard, but as I see no good reason for doing so, I'm not telling how.
    Quote Originally Posted by Adak View Post
    io.h certainly IS included in some modern compilers. It is no longer part of the standard for C, but it is nevertheless, included in the very latest Pelles C versions.
    Quote Originally Posted by Salem View Post
    You mean it's included as a crutch to help ancient programmers limp along without them having to relearn too much.

    Outside of your DOS world, your header file is meaningless.

  10. #10
    Registered User
    Join Date
    Oct 2007
    Posts
    242
    Quote Originally Posted by Elysia View Post
    Don't feed the trolls.
    It's actually quite easy to block other apps from using the clipboard, but as I see no good reason for doing so, I'm not telling how.
    What I'm trying to do IS NOT for a virus purpose, I guarantee - as I've told you, a friend gave me 2 programs: one that creates a process of the other one, and the other one who OpenClipboard(), EmptyClipboard(), SetClipboardData() while(1)! Do you want me to upload this 2 executables here so you could see these programs?
    Last edited by eXeCuTeR; 07-27-2008 at 07:00 AM.

  11. #11
    Registered User
    Join Date
    Mar 2005
    Location
    Mountaintop, Pa
    Posts
    1,059
    eXeCuTeR,

    Just an FYI in case your intent is malevolent.

    The solution I proposed will probably work on Li'l Tommies home computer. But in a more professional setting such as private/public sector organizations, it will definitely be detected by workstation policy settings. Thus, you'll have the network/security administrator rolling over with laughter if you use this technique.

  12. #12
    C++まいる!Cをこわせ! Elysia's Avatar
    Join Date
    Oct 2007
    Posts
    22,449
    Remember this quote?
    Quote Originally Posted by eXeCuTeR View Post
    And yeah, I'm trying to make that no other application will be able to write to the clipboard.
    I really don't care if it's a virus or a prank or whatever.
    The thing is - you have not given a solid reason why you want to deny access to the clipboard.

    If you want to retake the clipboard from a program, simply kill the program.

    I find it silly to get a get an exercise to steal the clipboard from another program.
    Do you actually want to moderate the clipboard (ie, control who gains access and which does not)?
    Quote Originally Posted by Adak View Post
    io.h certainly IS included in some modern compilers. It is no longer part of the standard for C, but it is nevertheless, included in the very latest Pelles C versions.
    Quote Originally Posted by Salem View Post
    You mean it's included as a crutch to help ancient programmers limp along without them having to relearn too much.

    Outside of your DOS world, your header file is meaningless.

  13. #13
    Super Moderator VirtualAce's Avatar
    Join Date
    Aug 2001
    Posts
    9,590
    Well behaved programs do not mess with the clipboard 'chain'. The clipboard is supposed to be a global OS-wide object that all programs can access. This is why we can take a screenshot and then open up some image editing program and paste from the clipboard to create a new image.

    Any other behavior is completely against the design and therefore a misuse of the clipboard resource.
    Last edited by VirtualAce; 07-27-2008 at 07:54 PM.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Get Installed applications list and applications activity
    By arunarora in forum C++ Programming
    Replies: 5
    Last Post: 05-25-2009, 09:41 AM
  2. A question about windows programming
    By Hussain Hani in forum Windows Programming
    Replies: 16
    Last Post: 05-23-2007, 07:38 AM
  3. codeform version 1.2.0 #2
    By dwks in forum A Brief History of Cprogramming.com
    Replies: 42
    Last Post: 04-18-2007, 01:10 PM
  4. copying to clipboard
    By bballzone in forum Windows Programming
    Replies: 24
    Last Post: 09-30-2004, 03:24 PM
  5. Clipboard Modifier
    By Korhedron in forum Windows Programming
    Replies: 2
    Last Post: 01-03-2004, 01:32 PM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21