Results 1 to 4 of 4

Thread: Trapping Print Screen Key

  1. #1

    Thread Starter
    PowerPoster
    Join Date
    Aug 2000
    Location
    India
    Posts
    2,288
    Is there any way to trap "Print Screen" and "Alt" Keys.

  2. #2
    Guest
    Not sure what you mean by "trapping" the alt and print screen keys. But here is how you can tell if they are pressed by using the GetAsyncKeyState API function.


    Code:
    Private Declare Function GetAsyncKeyState _
    Lib "user32.dll" (ByVal vKey As Long) As Integer
    
    Private Const VK_MENU = &H12 'either alt key
    Private Const VK_SNAPSHOT = &H2C 'print screen
    
    Private Sub Timer1_Timer()
    
        If GetAsyncKeyState(VK_MENU) Then 
            Msgbox "Alt key pressed"
        ElseIf GetAsyncKeyState(VK_SNAPSHOT) Then
            Msgbox "Print screen key pressed"
        End If
    
    End Sub

  3. #3
    Hyperactive Member Steve Stunning's Avatar
    Join Date
    Jul 1999
    Location
    Fairfax, Virginia
    Posts
    314

    Talking

    Thanks!! I was asked to add this as a feature to a program I am creating. The user wants to prevent people from capturing the screen of employees photographs displayed on an index.
    Steve Stunning

  4. #4
    Guest
    GetAsyncKeyState will not prevent this from happening. If you want to prevent it, you'd need to create a systemwide hook.

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