StuGreentree
IS-IT--Management
I am currently adding a visual & audible alarm to a form I have created. The alarm is event driven and I am searching for a way to turn it off. I have tried both the getKeyState and GetAsyncKeyState, but it will not respond to either except in Debug Mode. I have enclosed the general code I have been using to invoke the alarm. Any help would be appreciated. Thanks.....]
Private Sub Text0_KeyPress(KeyAscii As Integer)
Dim Keystate As Integer, Flag as Boolean
Flag = True
Do While Flag
Text0.Value = "ALERT!!! Account is Overdrawn"
Text0.BackColor = RGB(255, 0, 0)
Text0.ForeColor = RGB(0, 0, 0)
Call PlaySound("Sprngbng.wav", 0, &H1) 'WIN32 API Call
Me.Repaint
For Y = 1 To 7000000: Next Y
Text0.BackColor = RGB(192, 192, 192)
Text0.ForeColor = RGB(255, 0, 0)
Me.Repaint
For Y = 1 To 7000000: Next
Keystate = GetAsyncKeyState(vbKeySpace)
If Keystate > 0 Then
Flag = False
End If
Loop
End Sub
Private Sub Text0_KeyPress(KeyAscii As Integer)
Dim Keystate As Integer, Flag as Boolean
Flag = True
Do While Flag
Text0.Value = "ALERT!!! Account is Overdrawn"
Text0.BackColor = RGB(255, 0, 0)
Text0.ForeColor = RGB(0, 0, 0)
Call PlaySound("Sprngbng.wav", 0, &H1) 'WIN32 API Call
Me.Repaint
For Y = 1 To 7000000: Next Y
Text0.BackColor = RGB(192, 192, 192)
Text0.ForeColor = RGB(255, 0, 0)
Me.Repaint
For Y = 1 To 7000000: Next
Keystate = GetAsyncKeyState(vbKeySpace)
If Keystate > 0 Then
Flag = False
End If
Loop
End Sub