Включение NumLock при открытии формы |
Private Sub Form_Load() If GetNumlock <> True Then Call SetNumlock(True) SendKeys "{F11}", False End Sub
Option Compare Database Option Explicit Private Declare Function LoadKeyboardLayout Lib "user32" Alias _ "LoadKeyboardLayoutA" (ByVal pwszKLID As String, ByVal flags As Long) As Long 'для NumLock----------------- Private Const vbKeyScrollLock = &H91 Private Const vbKeyNumlock = &H90 Private Declare Function GetKeyState Lib "user32" (ByVal nVirtKey As Long) As Integer Private Declare Function GetKeyboardState Lib "user32" (pbKeyState As Byte) As Long Private Declare Function SetKeyboardState Lib "user32" (lppbKeyState As Byte) As Long 'для NumLock----------------- Function Keyboard() 'Переключение на английскую раскладку 'Call LoadKeyboardLayout("00000409", &H1) 'Переключение на русскую раскладку Call LoadKeyboardLayout("00000419", &H1) End Function Public Sub SetNumlock(Value As Boolean) ' Return or set the Numlock toggle. Call SetKeyState(vbKeyNumlock, Value) End Sub Public Function GetNumlock() As Boolean ' Return or set the Numlock toggle. GetNumlock = CBool(GetKeyState(vbKeyNumlock) And 1) End Function Public Sub SetKeyState(intKey As Integer, fTurnOn As Boolean) ' Retrieve the keyboard state, set the particular ' key in which you're interested, and then set ' the entire keyboard state back the way it ' was, with the one key altered. Dim abytBuffer(0 To 255) As Byte GetKeyboardState abytBuffer(0) abytBuffer(intKey) = CByte(Abs(fTurnOn)) SetKeyboardState abytBuffer(0) End Sub
http://www.sql.ru/forum/1147160/vkluchenie-numlock-pri-otkrytii-formy
Комментировать | « Пред. запись — К дневнику — След. запись » | Страницы: [1] [Новые] |