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 derfloh on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

.avi and MCI API HELP! :(

Status
Not open for further replies.

jguy

IS-IT--Management
Nov 17, 2000
69
US
Greetings, all. I am trying to basically create a 'small' program in VB5 that will play an avi file when it is started. I have created a module (module1)

CODE:
Declare Function mciSendString Lib "winmm.dll" Alias _
"mciSendStringA" (ByVal lpstrCommand As String, ByVal _
lpstrReturnString As String, ByVal uReturnLength As Long, _
ByVal hwndCallback As Long) As Long

O.k, I also created a form (form1), which's property visible is set to FALSE in the formload event (so no one knows that it exsists).

I then added this code to the form1.onload event:
CODE:
Private Sub Form_Load()
Form1.Visible = True
Dim sReturn As String * 128
Dim lPos As Long
Dim lStart As Long

Last$ = Form1.hWnd & " Style " & &H40000000
ToDo$ = "open G:\Users Personal Directory\Share All\FAXPROGRAM\FINDFILE.avi Type avivideo Alias video1 parent " & Last$
i = mciSendString(ToDo$, 0&, 0, 0)

i = mciSendString("Where video1 destination", ByVal sReturn, Len(sReturn) - 1, 0)

lStart = InStr(1, sReturn, " ") 'pos of top
lPos = InStr(lStart + 1, sReturn, " ") 'pos of left
lStart = InStr(lPos + 1, sReturn, " ") 'pos width
lHeight = Mid(sReturn, lStart + 1)

i = mciSendString("put video1 window at 16 10 " & lWidth & " " & lHeight, 0&, 0, 0)
i = mciSendString("play video1 wait", 0&, 0, 0)
i = mciSendString("close video1", 0&, 0, 0)

O.k., once I start the program, I just get a form, no .avi or anything.....aggghhhh!

I just want the .avi to play all the way through, and once played once, it'll unload from memory and the program will close 'END'.

Anybody know??? Thanks!
Joe W. Guy
Network Admin
MIS Director
 
Dump all that, and use Activemovie player:
Add the Activemovie object to your form, don't worry about how it looks, you can control everything in the properties dialog or upon form.load

Explore the properties box to turn off sliders, controls, adjust border types and window size. You can right click and select properities on the activemovie control to adjust its autorun, volume, etc. - its quick and simple and can be made to look slick if you make it invisible until the Open_Complete event where you can issue Activemovie1.visible = true
You can set the filename at design time and make it play upon Open_complete: Activemovie1.run
Not only will it play AVIs, it will play anything you throw at it including audio, WMFs, MP3! Good Luck
 
I tried your suggestion (BTW, what a great one!) and I can't get the program to execute. I get a error box that says "System Error &H80004005(-2147467259). Unspecified error" at runtime. When I remove the movie control, the program will run. Any ideas????? Thanks!

Joe Joe W. Guy
Network Admin
MIS Director
 
hei jguy! I have the exact same problem here. Btw wich version o WMP are you using?
If you find what's the problem please let me know and I'll do the same.
 
You need to make sure you're using a newer Windows Media Player, like ver 6 or 7. Surpisingly, when you update these, the problem will go away. Also check the version of DirectX, most of the time, it will be updated when you download WMP. Don't use the one that came with Win95/98. I've also found this to be the case more with VB6 than VB5. You should also obtain SP3 for VB6.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top