Computerhilfen.de Logo
Forum
Tipps
News
Frage stellen

vb-6.0=> wer weiß code für sound?

Hi,

Ich versuche schon lange zu probieren, dass wenn ich auf einen Commandbutton klicke, dass dann endlich mal ein Ton aus meinen Boxen kommt  >:(
Wenn es geht auch endlosschleife ;D
Und , dass ich wenn ich den Ton nicht mehr will, ich wieder auf den button klicke (kann auch ein anderer sein).

Wer weiß den code dazu?
Ich habe schon ein paar varianten prob. (sndplaysound)
oder ähnliches. doch es kam eine Fehlermeldung. :(

KAnn mir einer helfen??
danke im Vorraus :)


Antworten zu vb-6.0=> wer weiß code für sound?:

Jo müsste doch mit sndPlaySoundA Pfad_zur_sounddatei, 1&
gehen

Und im ereignis click des buttons setzt einfach ne Variable(boolean) auf true

und fragst die dann ab, wenn die true ist spielt der sound und dann sezt sie auf false und stoppst den sound etc


Flags:
· lpszSound
A string that specifies the sound to play. This parameter can be either an entry in the registry or in WIN.INI that identifies a system sound, or it can be the name of a waveform-audio file. (If the function does not find the entry, the parameter is treated as a filename.) If this parameter is NULL, any currently playing sound is stopped.

· fuSound
Flags for playing the sound. The following values are defined:
SND_ASYNC
The sound is played asynchronously and the function returns immediately after beginning the sound. To terminate an asynchronously played sound, call sndPlaySound with lpszSoundName set to NULL.
SND_LOOP
The sound plays repeatedly until sndPlaySound is called again with the lpszSoundName parameter set to NULL. You must also specify the SND_ASYNC flag to loop sounds.
SND_MEMORY
The parameter specified by lpszSoundName points to an image of a waveform sound in memory.
SND_NODEFAULT
If the sound cannot be found, the function returns silently without playing the default sound.
SND_NOSTOP
If a sound is currently playing, the function immediately returns FALSE, without playing the requested sound.
SND_SYNC
The sound is played synchronously and the function does not return until the sound ends.

Gruß

Hat VB keine Unicode Unterstützung?
Und sollte dafür nicht noch die winmm lib gelinkt werden? Man merkt ich habe keine Ahnung von VB. ::)

VB6 suckt

ja wenn er schon sagt er nutz die, hat er sie ja schon deklariert..

Declare Function sndPlaySound Lib "winmm.dll" Alias "sndPlaySoundA" (ByVal lpszSoundName As String, ByVal uFlags As Long) As Long

Zitat
VB6 suckt
Jo wenn man keine Ahnung hat wovon man spricht solte mans halt seinlasen...

Gruß
« Letzte Änderung: 23.05.04, 21:01:48 von Nighty »
Zitat
VB6 suckt
Jo wenn man keine Ahnung hat wovon man spricht solte mans halt seinlasen...

Gruß

Und wenn man es auch nur glaubt manchmal auch

okay...
ich versuche es einfach nochmal :)
THX

 ;D

HI..mit dem Code kannst klänge abspielen. Allerdings keine zwei gleichzeitig und ich würd auch für musik einzubinden oder so nen anderen benutzen, aber um en "Blobb" oder "pling"  ;D zu erzeugen wenn man ne taste drückt ist er schon in ordnung:

Al im einem Modul musst du folgendes schreiben

__________________________________________________
Public Declare Function sndPlaySound Lib "Winmm" Alias "sndPlaySoundA" _
       (ByVal Datei As Any, ByVal Hingergrund As Long) As Long
-----------------------
Sub WAV_PLAY(Datei As String)
  Call sndPlaySound(Datei, 0)
End Sub
--------------------------------
Sub WAV_PLAYBACK(Datei As String)
  Call sndPlaySound(Datei, 1)
End Sub
____________________________________________

und in deinem command click dann z.B.:

_______________________________
Private Sub Command1_Click()

path = App.Path & ="\"

Wav_Playback path$ & "Pling.Wav"
_________________________________

Hoffe das hilft dir schonmal weiter

Gruß

Jan


« Tubro Pascal ProjektWie kann ich eine Datei erstellen, die automatisch eine andere Datei öffnet... »
 

Schnelle Hilfe: Hier nach ähnlichen Fragen und passenden Tipps suchen!

Fremdwörter? Erklärungen im Lexikon!
Toner
Der Toner in Laserdruckern und Kopierern ist ein feines, trockenes Pulver, das aus einer Mischung von Kunstharz, Pigmenten für die Farbe, magnetisierbaren Metalloxid...

HiJackThis
Unter dem Begriff HiJackThis verbirgt sich ein  Sicherheitsprogramm, dass den Computer nach Schad-Programmen und Viren durchsucht. Dazu werden spezielle Bereiche in ...

Thermosublimationsdrucker
Ein Thermosublimationsdrucker wird oft für hochwertige Fotodrucke verwendet. Die Farben werden nicht direkt auf das Papier aufgetragen, sondern erhitzt, bis sie sich...