@msdn=http://search.microsoft.com/search/results.aspx?qu=$$$ @pinvoke=http://pinvoke.net/$$$.htm Summary: The GetKeyState function retrieves the status of the specified virtual key. The status specifies whether the key is up, down, or toggled (on, off—alternating each time the key is pressed). !!!!C# Signature: [DllImport("coredll.dll", SetLastError=true)] public static extern short GetKeyState([VK] nVirtKey); !!!!VB Signature: Declare Function GetKeyState Lib "coredll.dll" (ByVal nVirtKey As [VK]) As Short !!!!User-Defined Types: [VK] !!!!Alternative Managed API: Do you know one? Please contribute it! !!!!Notes: This function is very similar to the user32 function of the same name !!!!Tips & Tricks: Please add some! !!!!Sample Code: This sample VB.net code will check whether the NumLock is on or off. Const VK_NUMLOCK As Integer = CInt(System.Windows.Forms.Keys.NumLock) Dim keystate As Short = GetKeyState(VK_NUMLOCK) If (keystate = 0) Then MsgBox("NumLock is off") Else MsgBox("NumLock is on") End If Documentation: GetKeyState@msdn on MSDN
Edit coredll.GetKeyState
You do not have permission to change this page. If you feel this is in error, please send feedback with the contact link on the main page.