Click here to Skip to main content
15,894,291 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
hi..

i need to disable the print screen and ctrl keys in my silverlight web application.

if the user press the print screen or ctrl keys i need to pass a message "the keys are disabled".

how to do this..

need ur suggestions..

regards
gopal.s
Posted
Updated 20-Sep-12 20:16pm
v2

you wanna code in server side or client side ?
 
Share this answer
 
Comments
gopal_nivas84 24-Sep-12 2:33am    
hi ambesha..
thanks for ur reply..

if a client the pressing the print screen key from his machine and i need to avoid that..

so for me whether its a client side or server side code but i need to control the print screen option from client machine during accessing my silverlight web appl.

need ur suggestions..

regards
gopal.s
Friend, try the code below:
XML
<html><head>
<script language="JavaScript"><!--
function clp_clear() {
   var content=window.clipboardData.getData("Text");
   if (content==null) {
      window.clipboardData.clearData();}
   setTimeout("clp_clear();",1000);}
--></script></head>
<body onload='clp_clear()'>
<center><font color=darkgreen><font size=3><p>
...Press the [PrintScreen] or the [Alt+PrintScreen] key and try to paste the content in your favorite Picture Editor (Paint,...)...<br>
...Select text and try to paste the content in your favorite Text Editor (Notepad,...)...<p><font color=black><font size=2>
This small script clears the clipboard at runtime and disables screen capture process...but does not disable text selection..</center>
<hr>for more Ambesha blog, please visit <a href="http://ambeshdevloper.blogspot.com/">http://ambeshdevloper.blogspot.com/</a>[<a href="http://ambeshdevloper.blogspot.com/" target="_blank" title="New Window">^</a>] </body></html>


Please let me know if you want any specific...or server side code but in best practice for this task client scripting is appropriate. (please rate this reply)
Thanks,
Ambesha
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900