Hi All;
Please, if any one knows the visual basic code, to be added to a Stop button in order to stop playing some sound of (*.Wav) type. I have achieved to find the code for start playing sound or music which is:
OLE.DoVerb (vbOLEPrimary)
But the one to stop or interupt the sound I could not find it.
Please let know
Thank you in advance
M C Benzerari
4 5034
Hi All;
Please, if any one knows the visual basic code, to be added to a Stop button in order to stop playing some sound of (*.Wav) type. I have achieved to find the code for start playing sound or music which is:
OLE.DoVerb (vbOLEPrimary)
But the one to stop or interupt the sound I could not find it.
Please let know
Thank you in advance
M C Benzerari
Give this a whirl, Benzerari: -
-
Private Sub Form_Load()
-
Dim app_path As String
-
-
app_path = App.Path
-
If Right$(app_path, 1) <> "\" Then app_path = app_path _
-
& "\"
-
txtFile.Text = app_path & "Alice_Cooper-Gimmie.mp3"
-
-
' Prepare the audio control.
-
mmcAudio.Notify = False
-
mmcAudio.Wait = True
-
mmcAudio.Shareable = False
-
mmcAudio.Command = "Close"
-
End Sub
-
-
' Play the MP3 file.
-
Private Sub cmdPlay_Click()
-
If cmdPlay.Caption = "Play" Then
-
mmcAudio.FileName = txtFile.Text
-
mmcAudio.Command = "Open"
-
mmcAudio.Command = "Play"
-
cmdPlay.Caption = "Stop"
-
Else
-
mmcAudio.Command = "Stop"
-
mmcAudio.Command = "Close"
-
End If
-
End Sub
-
-
Private Sub mmcAudio_StatusUpdate()
-
lblAudio.Caption = mmcAudio.Position & "/" & _
-
mmcAudio.Length
-
End Sub
-
-
' Prepare the control to play again.
-
Private Sub mmcAudio_Done(NotifyCode As Integer)
-
mmcAudio.Command = "Close"
-
lblAudio.Caption = ""
-
cmdPlay.Caption = "Play"
-
End Sub
-
-
Private Sub Form_Unload(Cancel As Integer)
-
' Close the multimedia device.
-
mmcAudio.Command = "Close"
-
End Sub
-
-
Hopefully this is what you wanted. Let us know if it works, just found this one...
Give this a whirl, Benzerari: -
-
Private Sub Form_Load()
-
Dim app_path As String
-
-
app_path = App.Path
-
If Right$(app_path, 1) <> "\" Then app_path = app_path _
-
& "\"
-
txtFile.Text = app_path & "Alice_Cooper-Gimmie.mp3"
-
-
' Prepare the audio control.
-
mmcAudio.Notify = False
-
mmcAudio.Wait = True
-
mmcAudio.Shareable = False
-
mmcAudio.Command = "Close"
-
End Sub
-
-
' Play the MP3 file.
-
Private Sub cmdPlay_Click()
-
If cmdPlay.Caption = "Play" Then
-
mmcAudio.FileName = txtFile.Text
-
mmcAudio.Command = "Open"
-
mmcAudio.Command = "Play"
-
cmdPlay.Caption = "Stop"
-
Else
-
mmcAudio.Command = "Stop"
-
mmcAudio.Command = "Close"
-
End If
-
End Sub
-
-
Private Sub mmcAudio_StatusUpdate()
-
lblAudio.Caption = mmcAudio.Position & "/" & _
-
mmcAudio.Length
-
End Sub
-
-
' Prepare the control to play again.
-
Private Sub mmcAudio_Done(NotifyCode As Integer)
-
mmcAudio.Command = "Close"
-
lblAudio.Caption = ""
-
cmdPlay.Caption = "Play"
-
End Sub
-
-
Private Sub Form_Unload(Cancel As Integer)
-
' Close the multimedia device.
-
mmcAudio.Command = "Close"
-
End Sub
-
-
Hopefully this is what you wanted. Let us know if it works, just found this one...
Thank you very much for this reply, I did know it is so long like that, the code to start play some sound of ( .WAV ) type, uses OLE control, I though it is similar for stoping it too?
but any way I am going to try it and let you know
Thank you
M C Benzerari
Sorry! I wanted to say:
Thank you very much for this reply, I did NOT know it is so long like that, the code to start play some sound of ( .WAV ) type, uses OLE control, I though it is similar for stoping it too?
but any way I am going to try it and let you know
As there is no way to correct a thread once added...
Thank you
M C Benzerari
Give this a whirl, Benzerari: -
-
Private Sub Form_Load()
-
Dim app_path As String
-
-
app_path = App.Path
-
If Right$(app_path, 1) <> "\" Then app_path = app_path _
-
& "\"
-
txtFile.Text = app_path & "Alice_Cooper-Gimmie.mp3"
-
-
' Prepare the audio control.
-
mmcAudio.Notify = False
-
mmcAudio.Wait = True
-
mmcAudio.Shareable = False
-
mmcAudio.Command = "Close"
-
End Sub
-
-
' Play the MP3 file.
-
Private Sub cmdPlay_Click()
-
If cmdPlay.Caption = "Play" Then
-
mmcAudio.FileName = txtFile.Text
-
mmcAudio.Command = "Open"
-
mmcAudio.Command = "Play"
-
cmdPlay.Caption = "Stop"
-
Else
-
mmcAudio.Command = "Stop"
-
mmcAudio.Command = "Close"
-
End If
-
End Sub
-
-
Private Sub mmcAudio_StatusUpdate()
-
lblAudio.Caption = mmcAudio.Position & "/" & _
-
mmcAudio.Length
-
End Sub
-
-
' Prepare the control to play again.
-
Private Sub mmcAudio_Done(NotifyCode As Integer)
-
mmcAudio.Command = "Close"
-
lblAudio.Caption = ""
-
cmdPlay.Caption = "Play"
-
End Sub
-
-
Private Sub Form_Unload(Cancel As Integer)
-
' Close the multimedia device.
-
mmcAudio.Command = "Close"
-
End Sub
-
-
Hopefully this is what you wanted. Let us know if it works, just found this one...
Please can you send me a sketch of how the form related to the above code looks like, with enough details,...also you can send it as an attachement to benzerari1966@yahoo.com. as there is no way to attach it in the forum
Thank you
M C Benzerari
Sign in to post your reply or Sign up for a free account.
Similar topics
by: MLH |
last post by:
Edit, Insert Object & choose Wave Object, the following
OLE object thing gets inserted onto the form...
Microsoft Sound Recorder
Version 5.1 (Build 2600.xpsp2.030422-1633: Service Pack 1)...
|
by: MFC |
last post by:
Ok, after three C# books, (C# How to Program, Programming in the Key
of C#, and C# Weekend Crash Course) and three weeks, I believe I have
tried everything to make a certain form function...
|
by: Lee Moody |
last post by:
I just want quick and easy way to play a .wav file out the
standard sound device. It could even be as simple as
activating a sound assigned to an existing windows sound
event.
Any suggestions?...
|
by: James Bond |
last post by:
Hello. My 80+ year old father has recently decided to get his first
computer. Due to his age (and I suspect lack of playing pong as a child
like I did) he lacks the manual dexterity to use a mouse...
|
by: Fredrik Melin |
last post by:
If you open a form, add a button, double click on the button, you now enter
the code for the button click event.
If you switch back to the form, and remove the button, it will also remove
the...
|
by: U S Contractors Offering Service A Non-profit |
last post by:
Brilliant technology helping those most in need Inbox
Reply
U S Contractors Offering Service A Non-profit
show details
10:37 pm (1 hour ago)
Brilliant technology helping those most in need ...
|
by: laredotornado |
last post by:
Hi,
Is there a cross-browser way to play short (< 25K) sound files without
spawning new windows or embedding any visual controls on the page? I
would like to click a button and hear my short...
|
by: =?Utf-8?B?VmVybm9uIFBlcHBlcnM=?= |
last post by:
I have an application that is designed for using with a bar code scanner. I
want the user to know that the scan was complete and the data was entered, so
I am playing a system sound after data...
|
by: taylorcarr |
last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
|
by: aa123db |
last post by:
Variable and constants
Use var or let for variables and const fror constants.
Var foo ='bar';
Let foo ='bar';const baz ='bar';
Functions
function $name$ ($parameters$) {
}
...
|
by: ryjfgjl |
last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
|
by: ryjfgjl |
last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
|
by: emmanuelkatto |
last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud.
Please let me know.
Thanks!
Emmanuel
|
by: Hystou |
last post by:
There are some requirements for setting up RAID:
1. The motherboard and BIOS support RAID configuration.
2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
|
by: Hystou |
last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
|
by: Oralloy |
last post by:
Hello folks,
I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>".
The problem is that using the GNU compilers,...
|
by: jinu1996 |
last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
| |