2023年4月26日 星期三

SQL Server的最新更新和版本歷程記錄

 SQL Server的最新更新和版本歷程記錄

---

非常詳細的所有 MS-SQL 2008 到 MS-SQL 2022 核心版本記錄表

不知道電腦到底安裝了哪一版本,可以到該網址內查看記錄表


2023年4月12日 星期三

vb.net keyboard hook example

 Imports System.Runtime.InteropServices

Public Class Form1

    Private Declare Function SetWindowsHookEx Lib "user32" Alias "SetWindowsHookExA" (ByVal idHook As Integer, ByVal lpfn As KeyboardProc, ByVal hmod As IntPtr, ByVal dwThreadId As Integer) As IntPtr

    Private Declare Function CallNextHookEx Lib "user32" (ByVal hhk As IntPtr, ByVal nCode As Integer, ByVal wParam As IntPtr, ByVal lParam As IntPtr) As IntPtr

    Private Declare Function UnhookWindowsHookEx Lib "user32" (ByVal hhk As IntPtr) As Boolean


    Private Delegate Function KeyboardProc(ByVal nCode As Integer, ByVal wParam As IntPtr, ByVal lParam As IntPtr) As IntPtr


    Private Const WM_KEYDOWN As Integer = &H100

    Private Const WH_KEYBOARD_LL As Integer = 13


    Private hHook As IntPtr


    Private Function KeyboardProcHandler(ByVal nCode As Integer, ByVal wParam As IntPtr, ByVal lParam As IntPtr) As IntPtr

        If nCode >= 0 AndAlso wParam = WM_KEYDOWN Then

            Dim vkCode As Integer = Marshal.ReadInt32(lParam)

            MessageBox.Show("Key Code: " & vkCode)

        End If

        Return CallNextHookEx(hHook, nCode, wParam, lParam)

    End Function


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

        hHook = SetWindowsHookEx(WH_KEYBOARD_LL, AddressOf KeyboardProcHandler, IntPtr.Zero, 0)

    End Sub


    Private Sub Form1_FormClosing(sender As Object, e As FormClosingEventArgs) Handles Me.FormClosing

        UnhookWindowsHookEx(hHook)

    End Sub

End Class

VBNET 攔截key值(二)

 Protected Overrides Function ProcessCmdKey(ByRef msg As System.Windows.Forms.Message, _

                                           ByVal keyData As System.Windows.Forms.Keys) _

                                           As Boolean


    If msg.WParam.ToInt32() = CInt(Keys.Enter) Then

        SendKeys.Send("{Tab}")

        Return True

    End If

    Return MyBase.ProcessCmdKey(msg, keyData)

End Function



Protected Overrides Function ProcessCmdKey(ByRef msg As System.Windows.Forms.Message, ByVal keyData As System.Windows.Forms.Keys) As Boolean

    Dim keyCode As Keys = CType(msg.WParam, IntPtr).ToInt32

    Const WM_KEYDOWN As Integer = &H100


    If msg.Msg = WM_KEYDOWN AndAlso keyCode = Keys.Enter _

     AndAlso Me.ActiveControl.GetType.Name = "TextBox" Then

        Me.SelectNextControl(Me.ActiveControl, True, True, False, True)

        Return True


    End If

    Return MyBase.ProcessCmdKey(msg, keyData)



End Function

2023年4月5日 星期三

VBNET 攔截key值

 Public Class Form1

    Private Declare Function GetAsyncKeyState Lib "user32" (ByVal vkey As Integer) As Integer


    Private Sub Timer1_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer1.Tick

        If GetAsyncKeyState(Keys.L) Then

            MsgBox("Tada!")

        End If

    End Sub

End Class