codetoad.com
  ASP Shopping CartForum & BBS
  - all for $20 from CodeToad Plus!
  
  Home || ASP | ASP.Net | C++/C# | DHTML | HTML | Java | Javascript | Perl | VB | XML || CodeToad Plus! || Forums || RAM 
Search Site:
Search Forums:
  Playing Sound Waves  ripps7 at 15:57 on Thursday, September 04, 2003
 



I have tried to get the Windows API PlaySound to work in my VB application. It plays no sound. Any suggestions ?

Here is my code :

In a seperate module I declare all my API functions ...

*********************************
Public Declare Function PlaySound Lib "winmm.dll" _
Alias "PlaySoundA" (ByVal lpszName As String, _
ByVal hModule As Long, ByVal dwFlags As Long) As Long


Public Const SND_ASYNC = &H1
Public Const SND_LOOP = &H8
Public Const SND_NODEFAULT = &H2
Public Const SND_SYNC = &H0
Public Const SND_NOSTOP = &H10
Public Const SND_MEMORY = &H4
Public Const SND_RESOURCE = &H40004

**********************************


in Form1 module, Command1_Click()...


Dim intRet As Long
Dim SoundArray() As Byte
SoundArray = LoadResData(5001, "Custom")
intRet = PlaySound(SoundArray(0), App.hInstance, _
SND_RESOURCE Or SND_ASYNC Or SND_LOOP)



NO SOUND is heard, when button is clicked. Originally, it played a default sound, and even after ending my program, the default sound continued to loop. I closed VB6 and then the default sound which had still been looping stoped. I started program again after adding SND_NODEFAULT flag to the PlaySound function .... but since then there is no sound. I then took out the SND_NODEFAULT flag and now it doesn't even play a default sound.

Thanks for any help possible!



  Re: Playing Sound Waves  Linky at 14:39 on Saturday, January 31, 2004
 

I imaging by now you have found the answer. If not, Peter Wright covers the issue with sample code in his book "beginning Visual Basic 6". If you need it, I can send you the code snippet.
Linky, philiplink@comcast.net
2/1/2004

  Re: Playing Sound Waves  Elain at 08:04 on Monday, November 22, 2010
 

I think the question is difficult for me to ansewr! I'm sorry i can't give you any helpness!
--------------------------------------------
flash banner|logo maker|flash menu|








CodeToad Experts

Can't find the answer?
Our Site experts are answering questions for free in the CodeToad forums








Recent Forum Threads
•  Re: submit button on html form
•  Re: FREE TV on your PC!
•  Re: How to edit a PCL file
•  Re: How to open a pop up without Titlebar?
•  Re: Testing if object exists in IE
•  Re: windows service - web service - com
•  Re: Save up to 80% on SSL Certificates, RapidSSL Certificate @ $ 11.00/yr.
•  Re: Using ASP to write RTF
•  Re: My DHTML navigation menu bar disappears WHY?


Recent Articles
ASP GetTempName
Decode and Encode UTF-8
ASP GetFile
ASP FolderExists
ASP FileExists
ASP OpenTextFile
ASP FilesystemObject
ASP CreateFolder
ASP CreateTextFile
Javascript Get Selected Text


© Copyright codetoad.com 2001-2010