Free Games Forum
Free Games Games Forums Music Forums TV Forums

  Free Games Forum Home FORUM
HOME
Search Posts SEARCH
POSTS
Who's Online WHO'S
ONLINE
Log in LOG
IN
Rules & FAQ RULES / FAQ
REPORT SPAM

Free Games Forum: Game Technology: Visual Basic / VB:
How to make computer beep without speakers, and need help with it in VB

 

 


brownhead
Member

Jan 6, 2006, 5:05 PM

Post #1 of 5 (1393 views)
Shortcut
How to make computer beep without speakers, and need help with it in VB Can't Post

I'm trying to figure out how to make the computer tower beep. I was into DOS before VB and figured out how to do it in the Command Prompt, and heres how:
  1. Open Command Prompt (Start Menu->Run then type in CMD and hit OK)
  2. Make sure the prompt is your active window than press Ctrl+g (At the same time)
  3. The current command line should now read: ^G
  4. Press Enter


There ya go, you computer should have beeped, without the speakers. Now I'm trying to replicate that using VB. The Character Code of the character used to make the computer beep in DOS is 7 (Decimal) and 07 (Notice a similarity there Wink) and for no reason, heres the binary 0000 0111 (I'll admit, I don't think anybodies gonna want or need the binary, but there ya go, just in case). BTW, I don't want to create a Batch file then run it, I wanna try to find out how to do it completly in VB. If anybody can figure out how to do it, couldya post here, or PM me. I think it'll be a pretty short code. G'day all, and thanks for the help.


-------------------------------------


[img]http://i25.photobucket.com/albums/c51/70k0/BHU.png[/img]

(This post was edited by brownhead on Jan 6, 2006, 5:11 PM)



Cruel__Machine
Senior Member


Jan 6, 2006, 5:51 PM

Post #2 of 5 (1384 views)
Shortcut
Re: [brownhead] How to make computer beep without speakers, and need help with it in VB [In reply to] Can't Post

Make a new project and put in this code:


Code
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
Beep Cnt, 50
Me.Caption = Cnt
DoEvents
Next Cnt
End Sub

It's quite cool. :)


EOP
___________________________
"If evolution were true, I'd have a self-lubricating hand."

Programmers: http://Cruels.net


brownhead
Member

Jan 6, 2006, 7:17 PM

Post #3 of 5 (1379 views)
Shortcut
Re: [Cruel__Machine] How to make computer beep without speakers, and need help with it in VB [In reply to] Can't Post

Cool thanks, theres a problem though, I think the API works(the computer beeped)... but it FREEzes after its called. I tried taking it out of the for loop, still froze. Any Ideas? I'm gonna keep trying to get it.

Note: I'm using VB6


-------------------------------------


[img]http://i25.photobucket.com/albums/c51/70k0/BHU.png[/img]

(This post was edited by brownhead on Jan 6, 2006, 8:02 PM)


Cruel__Machine
Senior Member


Jan 7, 2006, 4:06 PM

Post #4 of 5 (1370 views)
Shortcut
Re: [brownhead] How to make computer beep without speakers, and need help with it in VB [In reply to] Can't Post

Hmm odd. Don't know...


EOP
___________________________
"If evolution were true, I'd have a self-lubricating hand."

Programmers: http://Cruels.net


brownhead
Member

Jan 7, 2006, 4:20 PM

Post #5 of 5 (1368 views)
Shortcut
Re: [Cruel__Machine] How to make computer beep without speakers, and need help with it in VB [In reply to] Can't Post

Using a laptop now and works like a charm. Probably just a problem with my computer, thanks :), this is exaclty what I was looking for


-------------------------------------


[img]http://i25.photobucket.com/albums/c51/70k0/BHU.png[/img]

 
 
 


Search for (options) Web Design by Web Ideas - Page loaded in: 0.16 s on (CGI/1.1)