12-24-2023, 05:53 PM
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