Postup:
Zalo₧te nov² projekt, v n∞m
modul a formulß°. Ve formulß°i nadefinujte statusbar tak, aby prvnφ
panel zobrazoval stav klßvesy NUM LOCK.
V modulu deklarujte nßsledujφcφ
k≤d:
Public Type
KeyboardBytes
kbByte(0 To 255) As Byte
End Type
Public kbArray As KeyboardBytes
Public Const VK_NUMLOCK = &H90
Public Declare Function GetKeyState Lib "user32" (ByVal
nVirtKey As Long) As Long
Public Declare Function GetKeyboardState Lib "user32" (kbArray As
KeyboardBytes) As Long
Public Declare Function SetKeyboardState Lib "user32" (kbArray As
KeyboardBytes) As Long
* ka₧dß
deklarace musφ b²t celß na samostatnΘm °ßdku
Ve formulß°i, na udßlost
PanelClick prvku Statusbar zapiÜte nßsledujφcφ k≤d:
Private Sub
StatusBar_PanelClick(ByVal Panel As ComctlLib.Panel)
Select Case Panel.Index
Case 1
'Prvnφ panel
v poli
GetKeyboardState kbArray
kbArray.kbByte(VK_NUMLOCK)
= IIf(kbArray.kbByte(VK_NUMLOCK) = 1, 0, 1)
SetKeyboardState kbArray
StatusBar.Refresh
End Select
End Sub
Nynφ spus¥te aplikaci a
klikßnφm na panel 1 ve statusbaru se bude p°epφnat klßvesa NUM LOCK a
bude se to projevovat i ve statusbaru. Pro ·plnost uvßdφm dalÜφ
konstanty, kterΘ lze pou₧φt pro zm∞nu stavu klßvesy:
Public Const VK_CAPITAL
= &H14
'CAPS LOCK
Public Const VK_INSERT =
&H2D
'INSERT
Public Const VK_SCROLL =
&H91 'SCROLL
LOCK
|