Results 1 to 21 of 21

Thread: making a beep

  1. #1

    Thread Starter
    Fanatic Member zmerlinz's Avatar
    Join Date
    May 2000
    Location
    in a world where the sun always shines on the bloody tv!!
    Posts
    604
    hi

    i know this should be in the API section but i will get more responce here, i know how to make a standard beep, but i found in windows api how to make specfic beeps, here is what i have got so far

    Code:
    Private Declare Function MessageBeep Lib "user32" (ByVal wType As Long) As Long
    
    Private Sub Command1_Click()
    MB_ICONEXCLAMATION As Long
    
    End Sub
    but it doesn't work it comes up with an error about statment invalid outside block, what am i doing wrong, i am new to api so please be gentle, thanks for your co-operation

    Some people have told me they don't think a fat penguin really embodies the grace of Linux, which just tells me they have never seen a angry penguin charging at them in excess of 100mph. They'd be a lot more careful about what they say if they had.
    -- Linus Torvalds

    [Galahtech.com] | [My Site] | [Fishsponge] | [UnixForum.co.uk]

  2. #2
    Guest
    That's because you're using the statement wrong. It should be:
    Code:
    Private Declare Function MessageBeep Lib "user32" (ByVal wType As Long) As Long
    Private Const MB_ICONASTERISK = &H40&
    Private Const MB_ICONEXCLAMATION = &H30&
    Private Const MB_ICONHAND = &H10&
    Private Const MB_ICONQUESTION = &H20&
    
    Private Sub Command1_Click()
        MessageBeep (MB_ICONHAND)
    End Sub

  3. #3
    Monday Morning Lunatic parksie's Avatar
    Join Date
    Mar 2000
    Location
    Mashin' on the motorway
    Posts
    8,169
    If you want an actual PC Speaker beep, then this does it: www.parksie.net/customwin.zip

    Full source for that and some other stuff.
    I refuse to tie my hands behind my back and hear somebody say "Bend Over, Boy, Because You Have It Coming To You".
    -- Linus Torvalds

  4. #4

    Thread Starter
    Fanatic Member zmerlinz's Avatar
    Join Date
    May 2000
    Location
    in a world where the sun always shines on the bloody tv!!
    Posts
    604
    Thanks a lot, sorry that i got it wrong and took a long while to reply

    thanks once again

    Some people have told me they don't think a fat penguin really embodies the grace of Linux, which just tells me they have never seen a angry penguin charging at them in excess of 100mph. They'd be a lot more careful about what they say if they had.
    -- Linus Torvalds

    [Galahtech.com] | [My Site] | [Fishsponge] | [UnixForum.co.uk]

  5. #5
    Monday Morning Lunatic parksie's Avatar
    Join Date
    Mar 2000
    Location
    Mashin' on the motorway
    Posts
    8,169
    No problem
    I refuse to tie my hands behind my back and hear somebody say "Bend Over, Boy, Because You Have It Coming To You".
    -- Linus Torvalds

  6. #6
    Junior Member
    Join Date
    Nov 2000
    Location
    Texas
    Posts
    27

    Angry ***?

    What is all this coding for? Use the damn "BEEP" command. Here's an example for you lame brained...

    Private Sub cmdCommandBtn_Click()
    Beep
    End Sub

    Wow! What skill.
    Software for the next century...

  7. #7
    PowerPoster Lethal's Avatar
    Join Date
    Oct 2000
    Location
    Ohio
    Posts
    2,496
    Well...for one, that beep will vary depending on your hardware and system software. With the use of the API, you can specify your sound durations and frequencys.

  8. #8
    Addicted Member Electro414's Avatar
    Join Date
    Nov 2000
    Location
    Do you know? I don't...
    Posts
    128
    Wouldn't it be just easyer to play a wav file?

  9. #9
    PowerPoster Lethal's Avatar
    Join Date
    Oct 2000
    Location
    Ohio
    Posts
    2,496
    Hmm....I think most would agree that the API Function Megatron provided is straight forward and can easily be understood.

  10. #10
    Monday Morning Lunatic parksie's Avatar
    Join Date
    Mar 2000
    Location
    Mashin' on the motorway
    Posts
    8,169
    The problem I found with the API "Beep" function (and the reason I coded my own) is that you can only use custom frequencies on NT.
    I refuse to tie my hands behind my back and hear somebody say "Bend Over, Boy, Because You Have It Coming To You".
    -- Linus Torvalds

  11. #11
    Lively Member
    Join Date
    Oct 2000
    Location
    Texas
    Posts
    111

    soundcard

    .WAVs won't work if the machine does not have a sound card. Thanks for the code Megatron, I have been looking for something like this.

  12. #12
    I wonder how many charact
    Join Date
    Feb 2001
    Location
    Savage, MN, USA
    Posts
    3,704

    more than meets the eye...

    still wondering... how does a huge robot that stands over 15 feet tall transform into a gun about the size of a dog.... OPTIMUS lives...

  13. #13
    Lively Member
    Join Date
    Oct 2000
    Location
    Texas
    Posts
    111

    Talking because he's evil

    Duh!

  14. #14

    Thread Starter
    Fanatic Member zmerlinz's Avatar
    Join Date
    May 2000
    Location
    in a world where the sun always shines on the bloody tv!!
    Posts
    604

    mmmmm

    The reason that i wanted it in API is that i am experimenting with it, and it will play specific sounds on your computer, eg asterix, and exclamation, i know the beep command, but that wouldn't work for me as i don't have a pc speaker

    Some people have told me they don't think a fat penguin really embodies the grace of Linux, which just tells me they have never seen a angry penguin charging at them in excess of 100mph. They'd be a lot more careful about what they say if they had.
    -- Linus Torvalds

    [Galahtech.com] | [My Site] | [Fishsponge] | [UnixForum.co.uk]

  15. #15
    coder. Lord Orwell's Avatar
    Join Date
    Feb 2001
    Location
    Elberfeld, IN
    Posts
    7,628
    argh!


    One complains that it doesn't work without a sound card, another that he doesn't have a speaker. Well the answer to both would be to have a flashing icon.
    My light show youtube page (it's made the news) www.youtube.com/@lightsofelberfeld
    Contact me on the socials www.facebook.com/lordorwell

  16. #16

    Thread Starter
    Fanatic Member zmerlinz's Avatar
    Join Date
    May 2000
    Location
    in a world where the sun always shines on the bloody tv!!
    Posts
    604

    mmmmm

    but i wanted it for the specific windows sounds, and i wanted to do it in API, i am not moaning !!!

    Some people have told me they don't think a fat penguin really embodies the grace of Linux, which just tells me they have never seen a angry penguin charging at them in excess of 100mph. They'd be a lot more careful about what they say if they had.
    -- Linus Torvalds

    [Galahtech.com] | [My Site] | [Fishsponge] | [UnixForum.co.uk]

  17. #17
    Lively Member
    Join Date
    Oct 2000
    Location
    Texas
    Posts
    111

    ?

    neither am I, I just said that you can't play a .wav without a soundcard. I am going to use the code Megatron provided in an upcoming app.

  18. #18
    coder. Lord Orwell's Avatar
    Join Date
    Feb 2001
    Location
    Elberfeld, IN
    Posts
    7,628
    the beep api call is another one that for some reason microsoft crippled in win 95/98

    The messagebeep now contains that functionality too. This one guy was trying to make a morse code program, and we were trying to figure out how to change beep duration... turns out that parksie's way is the only way.
    My light show youtube page (it's made the news) www.youtube.com/@lightsofelberfeld
    Contact me on the socials www.facebook.com/lordorwell

  19. #19
    Fanatic Member
    Join Date
    Nov 2000
    Location
    Sydney Australia
    Posts
    804
    Just thought you might be able to use this in conjunction with the Beep API if you wanted the option of playing a wav if the sound card was installed:
    Code:
    'Author: Karthikeyan
    'Author's email: [email protected]
    'Date Submitted: 1/11/2001
    'Compatibility: VB 6
    
    'Task: Check whether sound card is installed or not using waveOutGetNumDevs API
    
    'Declarations
    Private Declare Function waveOutGetNumDevs Lib "winmm.dll" () As Long
    
    'Code: 
    Private Sub Form_Load()
    Dim ndevice As Integer
    ndevice = waveOutGetNumDevs()
    If ndevice > 0 Then
    MsgBox "Sound card is installed."
    Else
    MsgBox "Sound card is not installed."
    End If
    End
    End Sub

    James
    Last edited by JamesM; Mar 1st, 2001 at 09:33 PM.

  20. #20

    Thread Starter
    Fanatic Member zmerlinz's Avatar
    Join Date
    May 2000
    Location
    in a world where the sun always shines on the bloody tv!!
    Posts
    604

    cheers

    hi James,

    i was looking for that code the other day, i have used it before and it is very useful, thanks a lot

    Some people have told me they don't think a fat penguin really embodies the grace of Linux, which just tells me they have never seen a angry penguin charging at them in excess of 100mph. They'd be a lot more careful about what they say if they had.
    -- Linus Torvalds

    [Galahtech.com] | [My Site] | [Fishsponge] | [UnixForum.co.uk]

  21. #21
    New Member Ferret's Avatar
    Join Date
    Mar 2003
    Posts
    9

    comparing beeps

    thanks for the code I'm using for a training program but now want to build code for converting the other way except that I cant convert beeps to text?? can anyone give me a pointer on waht i could use. something that compares two wav files or that counts the number of beeps in a wav file ??
    thinking

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width