Follow along with the video below to see how to install our site as a web app on your home screen.
Note: This feature may not be available in some browsers.
Option Explicit
Public Const GWL_WNDPROC = (-4)
Public Const MOD_CONTROL = &H2
Public Const MOD_SHIFT = &H4
Public Const MOD_ALT = &H1
Public Const MY_HOTKEY = &H1000&
Public Const WM_HOTKEY = &H312
Declare Function UnregisterHotKey Lib "user32" (ByVal hwnd As Long, ByVal id As Long) As Long
Declare Function RegisterHotKey Lib "user32" (ByVal hwnd As Long, ByVal id As Long, ByVal fsModifiers As Long, ByVal vk As Long) As Long
Declare Function SetWindowLong Lib "user32" Alias "SetWindowLongA" (ByVal hwnd As Long, ByVal nIndex As Long, ByVal dwNewLong As Long) As Long
Declare Function CallWindowProc Lib "user32" Alias "CallWindowProcA" (ByVal lpPrevWndFunc As Long, ByVal hwnd As Long, ByVal Msg As Long, ByVal wParam As Long, ByVal lParam As Long) As Long
Public lpPrevWndProc As Long
Function WindowProc(ByVal hwnd As Long, ByVal uMsg As Long, ByVal wParam As Long, ByVal lParam As Long) As Long
If uMsg = WM_HOTKEY Then
If wParam = MY_HOTKEY Then
MsgBox "You pressed print screen"
End If
End If
WindowProc = CallWindowProc(lpPrevWndProc, hwnd, uMsg, wParam, lParam)
End Function
Option Explicit
Private Sub Form_Load()
RegisterHotKey hwnd, MY_HOTKEY, 0, vbKeySnapshot
lpPrevWndProc = SetWindowLong(hwnd, -4, AddressOf WindowProc)
End Sub
Private Sub Form_Unload(Cancel As Integer)
UnregisterHotKey hwnd, MY_HOTKEY
End Sub