Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

MMControl works only once!

Status
Not open for further replies.

emeryp

Programmer
Feb 2, 2003
25
US
I have a MMControl (multi-media control) that will call a wave file, but it only works the first time it is called. Here is the code:

With FrmCHAT.MMControl1
If (.Mode = 526) Then
.Command = "Close"
End If

'Set properties needed by MCI to open.
.Notify = False
.Wait = True
.Shareable = False
.DeviceType = "WaveAudio"
.FileName = WaveFile

'Open the MCI WaveAudio device.
.Command = "Open"
.Command = "Play"
End With
 
Looks like you set it up ok, but rather than checking if its being used at the begining of the code, make sure you close it after it plays the file. I wonder if your if statement up front is not catching that the control is still running even though its not playing anything.
 
Thanks, Mode 526 actually checks to see if the control is still in 'play' mode. I have now changed the code to stop the player then move to the previous track which in this case will default to the beginning of this track:

'this code checks only the first time called to set up the
'control
If Not (Pass) Then
With FrmCHAT.MMControl1
'Set properties needed by MCI to open.
.Notify = False
.Wait = True
.Shareable = False
.DeviceType = "WaveAudio"
.FileName = WaveFile
End With
Pass = True
End If

If (InStr(MsgRcv, MsgPerson)) Then
MsgBox "Wav should work"
With FrmCHAT.MMControl1
If (.Mode = 526) Then
.Command = "Stop"
.Command = "Prev"
Else
.Command = "Open"
End If

'Open the MCI WaveAudio device.
.Command = "Play"
End With
End If
 
Once the file has played, it needs to be reset to play from the beginning again as it does not automatically go back to the start.
To play it again, first set:
.command = "Prev"

then play again
 
Pete,
Please see that the code is checking for the mode of the device and setting it back to .PREV if it has played. The problem is that the player only plays once, the reset doesn't seem to work.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top