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

Possibly Related Threads…
Thread Author Replies Views Last Post
  simplistic misunderstanding about ; + "" in a print doppler 12 2,649 09-21-2024, 06:47 PM
Last Post: TDarcos
  How to Disable Windows Finish Setup Notifications. Pete 4 1,258 08-08-2024, 02:43 AM
Last Post: Pete
  Book for sanity/insanity break: "10 PRINT CHR$(205.5+RND(1)); : GOTO 10" CharlieJV 4 1,049 08-22-2023, 08:15 PM
Last Post: bplus
  Print source code from the IDE Kernelpanic 21 3,599 12-17-2022, 06:52 PM
Last Post: TempodiBasic

Forum Jump:


Users browsing this thread: 1 Guest(s)