Results 1 to 5 of 5

Thread: Disable Print Screen Key

  1. #1

    Thread Starter
    New Member
    Join Date
    Feb 2000
    Posts
    6
    How do I disable the Print Screen Key?

    I'm trying this:

    Private Sub txtText_KeyDown(KeyCode As Integer, Shift As Integer)
    If KeyCode = vbKeyPrint or KeyCode = vbKeySnapshot then
    KeyCode = 0
    End If
    End Sub

    But, when I press the Print Screen Key the event isn't fired. *ONLY* with Print Screen Key!!!

    Thanks in advance,

    Piazza


  2. #2
    Guest
    Well, basically the Print Screen key saves the screen to the Clipboard. So all you really have to do is clar the Clipboard. Try this code, below.

    Code:
    Private Sub txtText_KeyDown(KeyCode As Integer, Shift As Integer) 
    
       If KeyCode = vbKeyPrint or KeyCode = vbKeySnapshot then 
       Clipboard.Clear 
       End If 
    
    End Sub
    What I have done is just emptied the Clipboard after the screen was copied to it. I don't know if this is what you anted or not.

  3. #3
    Fanatic Member
    Join Date
    Jan 2000
    Location
    Nitro
    Posts
    633

    This also works too!

    If I am not wrong, Piazza wants to disable the "Print Screen" Key because he still wants to keep the previous data on the clipboard. "Clipboard.Clear" will clear everything.

    Therefore, inorder to still keep the previous data on the clipboard use:

    Code:
    Private Sub txtText_KeyDown(KeyCode As Integer, Shift As Integer) 
     If KeyCode = vbKeyPrint or KeyCode = vbKeySnapshot then 
        Keycode = 0
     End If 
    End Sub

  4. #4
    Guest
    I was somewhat debating about that before my previous reply. In any case, he has both answers right here.

  5. #5
    Fanatic Member
    Join Date
    Jan 2000
    Location
    Nitro
    Posts
    633
    Actually, careless of me, the answer I posted was also his original answer.

    Piazza is right, the event doesn't get fire when you press "Print Screen" key. I placed a break and it never fired the event. Therefore, both of our answer would not work. Hum! Let me see why!

    Do you have any idea Megatron?
    Chemically Formulated As:
    Dr. Nitro

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