Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Disable Print Screen?
#9
Finally having a little time to sit down and relax -- and try not to fall asleep with my stomach bursting with Christmas Eve Lunch -- I think I put the pieces together here for what you're looking for:

Code: (Select All)
'BOOL UnregisterHotKey(
'  [in, optional] HWND hWnd,
'  [in]          int  id
');

'BOOL RegisterHotKey(
'  [in, optional] HWND hWnd,
'  [in]          int  id,
'  [in]          UINT fsModifiers,
'  [in]          UINT vk
');

Const Alt = 1
Const VK_Snapshot = &H2C


Declare Dynamic Library "user32"
    Function RegisterHotKey%% (ByVal WindowHandle As _Offset, Byval id As Long, Byval keyModifiers As _Unsigned Long, Byval keyValue As _Unsigned Long)
    Function UnregisterHotKey%% (ByVal WindowHandle As _Offset, Byval id As Long)
End Declare

Dim Internal_Key_Name As Long

Dim WH As _Offset: WH = _WindowHandle

result = RegisterHotKey(0, 1, Alt, VK_Snapshot) '0 is null, so defaults to this program.  1 is the id value that we assign to... I dunno!  It just works!  LOL.
If result Then
    Print "Alt-Printscreen is enabled in this program."
    Print "Attempting to disable it..."
    result = UnregisterHotKey(0, 1)
    If result Then
        Print "We should now have disabled Alt-Printscreen in this application"
    Else
        Print "No luck.  Sorry dude.  Try again later!"
    End If
Else
    Print "No can do!  Either alt-printscreen is already broken or assigned elsewhere, or else we just goofed up somewhere!"
    Print "Sorry dude.  Try again later!"
End If
Reply


Messages In This Thread
Disable Print Screen? - by TerryRitchie - 12-15-2023, 08:01 PM
RE: Disable Print Screen? - by TerryRitchie - 12-15-2023, 09:11 PM
RE: Disable Print Screen? - by Steffan-68 - 12-15-2023, 10:28 PM
RE: Disable Print Screen? - by TerryRitchie - 12-16-2023, 05:05 AM
RE: Disable Print Screen? - by mnrvovrfc - 12-15-2023, 10:08 PM
RE: Disable Print Screen? - by SMcNeill - 12-15-2023, 10:32 PM
RE: Disable Print Screen? - by SMcNeill - 12-15-2023, 10:36 PM
RE: Disable Print Screen? - by TerryRitchie - 12-16-2023, 05:07 AM
RE: Disable Print Screen? - by SMcNeill - 12-24-2023, 05:53 PM
RE: Disable Print Screen? - by SMcNeill - 12-24-2023, 05:55 PM
RE: Disable Print Screen? - by Kernelpanic - 12-24-2023, 08:06 PM
RE: Disable Print Screen? - by TerryRitchie - 12-24-2023, 10:06 PM
RE: Disable Print Screen? - by SMcNeill - 12-25-2023, 12:13 AM
RE: Disable Print Screen? - by Kernelpanic - 12-25-2023, 07:45 PM



Users browsing this thread: 3 Guest(s)