Wednesday, April 29, 2009

Sound Beep

'Sound Beep

Private Declare Function Beep
Lib "kernel32" _

(ByVal dwFreq As Long,
ByVal dwDuration As Long)
As Long



Private Sub Form_Activate()

    Dim Cnt As Long

    For Cnt = 0 To
5000 Step 10

        'play a tone of Cnt Hertz, for 10 milliseconds

        Beep Cnt, 10

        Me.Caption = Cnt

        DoEvents

    Next Cnt

End Sub



'Sound Message Beep

Private Declare Function MessageBeep
Lib "user32" _

(ByVal wType As Long)
As Long

 

Private Sub Form_Load()

    Dim Cnt As Byte

    'Beep 100 times

    For Cnt = 1 To 100

        MessageBeep 0

    Next Cnt

End Sub

No comments:

Post a Comment