PasteSite.Com

Recent Pastes

Sign Up!

PasteSite is open to the public, but with limited features. Register to be able to modify access rights, track your pastes and more...

Change the theme

If you prefer reading light text on a dark background to dark text on a light background, then you might want to try the dark theme.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
Imports System.Net
Imports System.IO
 
Public Class Form1
 
 
    ''API functions
    Private Declare Function RegisterHotKey Lib "user32" (ByVal hwnd As IntPtr, ByVal id As Integer, ByVal fsModifiers As Integer, ByVal vk As Integer) As Integer
    Private Declare Function UnregisterHotKey Lib "user32" (ByVal hwnd As IntPtr, ByVal id As Integer) As Integer
 
    ''indicates hotkey pressed
    Private Const WM_HOTKEY As Integer = &H312
 
    ''modifier keycodes
    Private Const MOD_ALT As Integer = &H1
    Private Const MOD_CONTROL As Integer = &H2
    Private Const MOD_SHIFT As Integer = &H4
    Public Enum HotkeyModifierFlags
        MOD_ALT = &H1
        MOD_CONTROL = &H2
        MOD_SHIFT = &H4
        MOD_WIN = &H8
    End Enum
 
    Private Sub Form1_FormClosing(ByVal sender As Object, ByVal e As System.Windows.Forms.FormClosingEventArgs) Handles Me.FormClosing
        UnregisterHotKey(Me.Handle, 4866)
    End Sub
 
 
    Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
 
        RegisterHotKey(Me.Handle, 4866, MOD_CONTROL, Keys.NumPad3)
    End Sub
 
 
    Protected Overrides Sub WndProc(ByRef m As System.Windows.Forms.Message)
 
        If (m.Msg = WM_HOTKEY) Then
            If (m.WParam = CType(4866, IntPtr)) Then
                MsgBox("HOtkey")
            End If
        End If
 
        MyBase.WndProc(m)
    End Sub
 
End Class

Reply to This Paste

(leave blank to make this paste permanent)
(if set as private)