MyTetra Share
Делитесь знаниями!
Обработка сочетания горячих клавиш
25.03.2018
00:23
Текстовые метки: VB,
Раздел: VB

Обработка сочетания горячих клавиш

    Private Const WM_HOTKEY As Integer = &H312

    Private Const MOD_ALT As Integer = 2

    Public Declare Auto Function RegisterHotKey Lib "user32" (ByVal hWnd As IntPtr, ByVal id As Integer, ByVal fsModifiers As Integer, ByVal vk As Integer) As Boolean

    Public Declare Auto Function UnregisterHotKey Lib "user32" (ByVal hWnd As IntPtr, ByVal id As Integer) As Boolean

    Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load

        RegisterHotKey(Me.Handle, 1020, MOD_ALT, Keys.S)

    End Sub

  

    Protected Overrides Sub WndProc(ByRef m As System.Windows.Forms.Message)

        MyBase.WndProc(m)

        If (m.Msg = WM_HOTKEY) Then

            Dim hotKeyId As Integer = m.WParam.ToInt32()

            If hotKeyId = 1020 Then

                MsgBox("Нажато Ctrl+S")

            End If

        End If

    End Sub

Так же в этом разделе:
 
MyTetra Share v.0.52
Яндекс индекс цитирования