August 5, 2000

GetNumLockKey – Get the state of the NumLock key

Private Declare Function GetKeyState Lib “user32” (ByVal nVirtKey As Long) As _ Long’ Get the current state of the NumLock keyFunction GetNumLockKey() As Boolean GetNumLockKey = GetKeyState(vbKeyNumlock)End Function

SetScrollLockKey – Set the state of the ScrollLock key

Private Declare Sub keybd_event Lib “user32” (ByVal bVk As Byte, _ ByVal bScan As Byte, ByVal dwFlags As Long, ByVal dwExtraInfo As Long)Private Declare Function GetKeyState Lib “user32” (ByVal nVirtKey As Long) As _ LongPrivate Const KEYEVENTF_KEYUP = &H2Sub SetScrollLockKey(ByVal newState As Boolean) ‘ if the current state must be

PressVirtKey – Press and/or release any key

Private Declare Sub keybd_event Lib “user32” (ByVal bVk As Byte, _ ByVal bScan As Byte, ByVal dwFlags As Long, ByVal dwExtraInfo As Long)Private Declare Function GetKeyState Lib “user32″ (ByVal nVirtKey As Long) As _ LongPrivate Const KEYEVENTF_KEYUP = &H2′ press and/or release any key, given its virtual code” virtKeyCode can

SetNumLockKey – Set the state of the Num Lock key

Private Declare Sub keybd_event Lib “user32” (ByVal bVk As Byte, _ ByVal bScan As Byte, ByVal dwFlags As Long, ByVal dwExtraInfo As Long)Private Declare Function GetKeyState Lib “user32” (ByVal nVirtKey As Long) As _ LongPrivate Const KEYEVENTF_KEYUP = &H2Sub SetNumLockKey(ByVal newState As Boolean) ‘ if the current state must be

SetCapsLockKey – Set the state of the Caps Lock key

Private Declare Sub keybd_event Lib “user32” (ByVal bVk As Byte, _ ByVal bScan As Byte, ByVal dwFlags As Long, ByVal dwExtraInfo As Long)Private Declare Function GetKeyState Lib “user32” (ByVal nVirtKey As Long) As _ LongPrivate Const KEYEVENTF_KEYUP = &H2Sub SetCapsLockKey(ByVal newState As Boolean) ‘ if the current state must be

GetInsertKey – Get the current state of the Insert key

Private Declare Function GetKeyState Lib “user32” (ByVal nVirtKey As Long) As _ Long’ Get the current state of the Insert keyFunction GetInsertKey() As Boolean GetInsertKey = GetKeyState(vbKeyInsert)End Function

GetScrollLockKey – Get the state of the Scroll Lock key

Private Declare Function GetKeyState Lib “user32” (ByVal nVirtKey As Long) As _ Long’ Get the current state of the ScrollLock keyFunction GetScrollLockKey() As Boolean GetScrollLockKey = GetKeyState(vbKeyScrollLock)End Function

GetCapsLockKey – Get the state of the CapsLock key

Private Declare Function GetKeyState Lib “user32” (ByVal nVirtKey As Long) As _ Long’ Get the current state of the CapsLock keyFunction GetCapsLockKey() As Boolean GetCapsLockKey = GetKeyState(vbKeyCapital)End Function

Auto Select Content Component

We almost always need to develop forms in which the contents to the control have to be selected whenever the user tabs to a textbox or a combobox. For this we write two lines in the GotFocus event of each such control on the form. If the form contains 30

No more posts to show