How to determine the status of the keyboard such as INSERT, NUMLOCK in the VB.NET environment.

xiaoxiao2021-03-06  21

Public Declare Function GetKeyState Lib "User32" Alias ​​"getKeyState" (Byval Nvirtkey As INTEGER) AS INTEGER

Private sub button1_click (byvale as system.object, byval e as system.eventargs) Handles Button1.click

The status of the keyboard Caps Lock button is & H14, the INSERT key value is & H2D, which is most convenient to use Keys.Insert.

IF getKeyState (& H2D) THEN

Messagebox.show ("Light")

Else

Messagebox.show ("Light Oil")

END IF

'Change # h91 is the state of the Scroll Lock button,

'Change to & H90 is the state of Num Lock.

End Sub

转载请注明原文地址:https://www.9cbs.com/read-43138.html

New Post(0)