'*********************************************************************** ' DISPLAYED WITH PERMISSION OF ROY SCOTT ENTERPRISES ' AND THE AUTHOR AS AN ARCHIVING FUNCTION ' http://www.scottserver.net/forum/index.php ' ALL RIGHTS RESERVED '************************************************************************ ' MINOR EDITING PERFORMED BY UPLA STAFF '************************************************************************ 'Michael S. Sanders 'Microdeveloper ' Posted: Mon Dec 29, 2003 4:19 am Post subject: VB: Beacon() '-------------------------------------------------------------------------------- 'Here's a subtle way to give a visual indicator when you need to alert a user to a given condition. 'The idea is to repeatedly toggle the caps lock light on/off. '1. Create a form in a VB project and add a timer named Timer1 '2. Add the following code: 'Code: Option Explicit Private Declare Function GetKeyboardState _ Lib "user32" (pbKeyState As Byte) As Long Private Declare Function SetKeyboardState _ Lib "user32" (lppbKeyState As Byte) As Long Private Const VK_CAPITAL = &H14 Private Const VK_NUMLOCK = &H90 Public Sub Beacon() Dim KeyBuf(256) As Byte GetKeyboardState KeyBuf(0) KeyBuf(VK_CAPITAL) = IIf(KeyBuf(VK_CAPITAL) And 1, 0, 1) SetKeyboardState KeyBuf(0) End Sub Private Sub Form_Load() With Timer1 .Enabled = True .Interval = 500 End With End Sub Private Sub Timer1_Timer() If Example_Condition = True Then Call Beacon End If End Sub