Please Help Me! trying to play AVI file

  • Thread starter Russ via AccessMonster.com
  • Start date
R

Russ via AccessMonster.com

Found this code to play MIDI, WAV, or AVI files at the following URL ...

http://www.mvps.org/access/api/api0011.htm

But having problems with this code (well at least what I want it to do)
Private Sub cmdPlayAvi_Click()
Dim a As Long
Dim cnn As ADODB.Connection
Dim dbname As String
Set cnn = CurrentProject.Connection
dbname = cnn.Properties("data source")
MyPath= getpath(dbname) & "\AVI\demo.avi" 'tried this but did not do the
trick
a = fPlayStuff("C:\Documents and Settings\Russell\Desktop\RRDW My Database\
AVI\Clock.avi")
End Sub
'problem seems to be that there are spaces between the names of the folders i.
e. Documents and Settings
'I figured someone always moves the database so I do not want to hard code it.

("C:\Windows\demo.avi")
'any suggestions
 
R

Russ via AccessMonster.com

Paul, thanks...

But can you please explain a couple of thing?
in your line of code: fPlayStuff "clock.avi", 10 (what does the 10 stand for?)

Where are you telling it to look in My Documents for the file?
Can you please explain?

Thanks agian.
Russ

I have tried the code and It works ok.

here is a working copy for you to look at :

http://www.paulwest.me.uk/accessstuff/avi.zip

Put the DB and Avi in youy mydocuments folder.

Paul
Found this code to play MIDI, WAV, or AVI files at the following URL ...
[quoted text clipped - 18 lines]
("C:\Windows\demo.avi")
'any suggestions
 
D

Douglas J Steele

It's actually meaningless in the case of AVI or MID files.

For WAV files, look at the defined constants at
http://www.mvps.org/access/api/api0011.htm

Public Const pcsSYNC = 0 ' wait until sound is finished playing
Public Const pcsASYNC = 1 ' don't wait for finish
Public Const pcsNODEFAULT = 2 ' play no default sound if sound doesn't exist
Public Const pcsLOOP = 8 ' play sound in an infinite loop (until next
apiPlaySound)
Public Const pcsNOSTOP = 16 ' don't interrupt a playing sound

10 would be the combination of using pcsNODEFAULT and pcsLOOP. In other
words, it's won't play a default sound if the file passed doesn't exist. If
it does exist, it's going to play it forever.

--
Doug Steele, Microsoft Access MVP

(no e-mails, please!)


Russ via AccessMonster.com said:
Paul, thanks...

But can you please explain a couple of thing?
in your line of code: fPlayStuff "clock.avi", 10 (what does the 10 stand for?)

Where are you telling it to look in My Documents for the file?
Can you please explain?

Thanks agian.
Russ

I have tried the code and It works ok.

here is a working copy for you to look at :

http://www.paulwest.me.uk/accessstuff/avi.zip

Put the DB and Avi in youy mydocuments folder.

Paul
Found this code to play MIDI, WAV, or AVI files at the following URL ....
[quoted text clipped - 18 lines]
("C:\Windows\demo.avi")
'any suggestions
 
R

Russ via AccessMonster.com

thanks.

Where are you telling it to look in My Documents for the file?

It's actually meaningless in the case of AVI or MID files.

For WAV files, look at the defined constants at
http://www.mvps.org/access/api/api0011.htm

Public Const pcsSYNC = 0 ' wait until sound is finished playing
Public Const pcsASYNC = 1 ' don't wait for finish
Public Const pcsNODEFAULT = 2 ' play no default sound if sound doesn't exist
Public Const pcsLOOP = 8 ' play sound in an infinite loop (until next
apiPlaySound)
Public Const pcsNOSTOP = 16 ' don't interrupt a playing sound

10 would be the combination of using pcsNODEFAULT and pcsLOOP. In other
words, it's won't play a default sound if the file passed doesn't exist. If
it does exist, it's going to play it forever.
Paul, thanks...
[quoted text clipped - 23 lines]
 
P

Paul

Russ

I have not specified a folder within the code. I used the MyDocuments folder
as an example as you used this in your original code.

because no folder is specified the code looks in the same folder as the DB.

Paul
 
R

Russ via AccessMonster.com

Paul, I only put the Avi file in the My Documents folder, the database is on
my desktop and it works. So I assumed that you were pointing to it via code.

My problem is I figured someone always moves the database so I do not want to
hard code it. I wanted to make it look in a folder called AVI where the
database was installed and or moved to. tried this, but it did not work.

MyPath= getpath(dbname) & "\AVI\Clock.avi"
a = fPlayStuff("MyPath")
End Sub
'problem seems to be that there are spaces between the names of the folders
i.e. Documents and Settings or program files

Any ideas?



thanks.

Where are you telling it to look in My Documents for the file?
It's actually meaningless in the case of AVI or MID files.
[quoted text clipped - 17 lines]
 
P

Paul

Russ

I have come across this problem of spaces with folder names and never been
able to solve it. I nows always create folders, sub folders etc with no
spaces.

I think this problems is one for the MVP's.

Paul
 
D

Douglas J. Steele

IIRC, the MCI APIs will only work with short file names. Fortunately, there
are APIs that will translated between LFN and SFN. See
http://www.mvps.org/access/api/api0020.htm

However, when I was doing some tests for this question, I found that there
were certain AVI files that didn't seem to work with the MCI APIs,
regardless of whether it was a long or short file name.
 
R

Russ via AccessMonster.com

Is there other options for playing AVI fils?
Is there any way to play MPEG, is that any better?
IIRC, the MCI APIs will only work with short file names. Fortunately, there
are APIs that will translated between LFN and SFN. See
http://www.mvps.org/access/api/api0020.htm

However, when I was doing some tests for this question, I found that there
were certain AVI files that didn't seem to work with the MCI APIs,
regardless of whether it was a long or short file name.
[quoted text clipped - 31 lines]
 
D

Douglas J. Steele

I'm sure that if you've got a compliant client that exposes itself to
automation, you could do something there. Unfortunately, I haven't needed to
do anything like this, so I've never looked into it.

--
Doug Steele, Microsoft Access MVP

(no e-mails, please!)



Russ via AccessMonster.com said:
Is there other options for playing AVI fils?
Is there any way to play MPEG, is that any better?
IIRC, the MCI APIs will only work with short file names. Fortunately,
there
are APIs that will translated between LFN and SFN. See
http://www.mvps.org/access/api/api0020.htm

However, when I was doing some tests for this question, I found that there
were certain AVI files that didn't seem to work with the MCI APIs,
regardless of whether it was a long or short file name.
[quoted text clipped - 31 lines]
("C:\Windows\demo.avi")
'any suggestions
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top