CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 9 of 9

Thread: disable key

  1. #1
    Join Date
    Jun 2002
    Posts
    122

    disable key

    Is there a way to disable a key in a Java Applet? What I'm tring to accomplish is code an applet that will disable the "Print Screen" key on the keyboard. Any suggestions?

    I have a website that I'm tring to prevent images from being copied. Using the print screen key and coping it to a paint program seems like one way of coping images without my permission.
    Eric

  2. #2
    Join Date
    Apr 2003
    Location
    Israel
    Posts
    398
    hmmm that it intresting :

    try to add a key listener to the printscreen key and inside do nothing .
    hopefully that will overide windows printkey option .

    BUT!
    all the user will have to do is the following ,he will enlarge the applet to maximum ,select the start bar and then press print screen so your applet isnt incharge anymore.


    by uploading something to the internet you basicly declare that it is open to the public .
    acctually,today with all the crackers everything is open to the public :\
    so few pictures arent worth it .
    Vision.

  3. #3
    Join Date
    Jun 2002
    Posts
    122
    I'm not sure exactly how to accomplish this task. I think you're right though by adding a key listener. In addition, I also understand what you are saying. Coding an applet for just a few images isn't worth it. I think I'll need to code the applet in the KeyPressed event. Are you sure this is possible? I haven't been doing applets for a while and been away from Java so I feel like I'm relearning (if that makes sense).
    Eric

  4. #4
    Join Date
    Apr 2003
    Location
    Israel
    Posts
    398
    it might be possible ,but again its very easy to by pass.
    all the user needs to do is to press the printscreen key while the applet isnt selected.
    then the applet keylisteners arent on and windows takes control over all the keys.

    besideds i dont remember i have seen the print screen key in the keys list.

    what you want isnt operational.
    Vision.

  5. #5
    Join Date
    Jun 2003
    Location
    South Coast UK
    Posts
    70
    hi,

    You don't need to use PrintScreen to capture the screen.

    The following line untidy as it might be gets the Screen Size and captures a Screen Shot which is stored in the BufferedImage.

    Code:
    Rectangle screenSize = new Rectangle( Toolkit.getDefaultToolkit().getScreenSize() );
    BufferedImage image = new Robot().createScreenCapture( screenSize  );
    ps
    Code:
    new Robot()
    may throw a AWTException so will need to be catch if u wish to implement that code.

    Download the src, it takes two parameters which are how long it waits from executing the application and taking the picture, the other is what file to output it too (png file).
    Attached Files Attached Files

  6. #6
    Join Date
    Apr 2003
    Location
    Israel
    Posts
    398
    but he asked for away for not letting the user capture the screen
    and you gave him away to capture it .
    Vision.

  7. #7
    Join Date
    Jun 2003
    Location
    South Coast UK
    Posts
    70
    i know i didn't answer the exact question but i hope i made ecross aware how easy it is to by-pass the "Print Screen" key. so even totally disabling the key wont prevent people from copying the images

    i do really agree with your quote Ishaibin

    by uploading something to the internet you basically declare that it is open to the public.
    actually, today with all the crackers, everything is open to the public :\
    so few pictures arent worth it .

  8. #8
    Join Date
    Jun 2002
    Posts
    122
    That seems too much for what I'm tring to accomplish. Thanks for all of your input. If you find a better solution then please let me know. I guess I'll end up putting up a privacy statement page telling people not to copy without permission and etc like you see with other pages.
    Eric

  9. #9
    Join Date
    Apr 2003
    Location
    Israel
    Posts
    398
    hahah "good" solution
    Vision.

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

Featured