April 30, 2024, 05:28:07 AM

News:

Own IWBasic 2.x ? -----> Get your free upgrade to 3.x now.........


Display WMV file in dialog

Started by Bruce Peaslee, April 06, 2012, 10:23:36 AM

Previous topic - Next topic

0 Members and 2 Guests are viewing this topic.

Bruce Peaslee

I have a WMV file I want to display in a dialog without any Media Player control buttons, etc.

I have seen that some folks use AxWindowsMediaPlayer1, but in VB or C++.

Does anyone have any experience in this area?
Bruce Peaslee
"Born too loose."
iTired (There's a nap for that.)
Well, I headed for Las Vegas
Only made it out to Needles

LarryMc

Bruce,
I'm sure there is an easy way to code what you want using a windows API of some sort.
I've never looked for one(or better yet, I looked and didn't find one I understood enough) to do what you want to do.

However, years ago with IBPro I wanted to do the same thing as you want now.
I was trying to come up with a viewer to look at old movies on my family history cd that I give to people.

I accomplished my goal with an embedded player on an embedded web page.

So, if you use the embedded window ( like the recent discussion on embedding a gif in a dialog) as a basis
you can have the browser window display a page patterned after my example below.

You'll have to change the size to match your video dimensions.
Also the video path is listed in two places.
In my example the video will repeat forever.

Hope this at least gets you started.

LarryMc
LarryMc
Larry McCaughn :)
Author of IWB+, Custom Button Designer library, Custom Chart Designer library, Snippet Manager, IWGrid control library, LM_Image control library

ZeroDog

April 06, 2012, 07:01:06 PM #2 Last Edit: April 06, 2012, 07:14:19 PM by ZeroDog
DECLARE IMPORT,mciSendStringA(lpszCommand:STRING,lpszReturnString:STRING,cchReturn:INT,hwndCallback:int),int
DEF filename,MCIString,StatusBuffer:STRING
DEF WMVHolder,l,t,w,h,time,run:INT
DEF WMVLength:DOUBLE
def dlg:dialog

CREATEDIALOG dlg,0,0,400,300,0x80C80080,0,"SplashScreen",&dlghandler
showdialog dlg
getclientsize dlg, l,t,w,h

filename="C:\WINDOWS\system32\oobe\images\intro.wmv"
MCIString="open "+CHR$(34)+filename+CHR$(34)+" type MPEGVideo alias SplashMovie"
mciSendStringA(MCIString,"",0,0)
WMVHolder=INT(dlg.hwnd)
MCIString = "window SplashMovie handle " + str$(WMVHolder)
mciSendStringA(MCIString,"",0,0)
MCIString ="put SplashMovie destination at 0 0 "+str$(w)+" "+str$(h)
mciSendStringA(MCIString,"",0,0)
mciSendStringA("set SplashMovie time format ms" ,"",0,0)
mciSendStringA("status SplashMovie length",StatusBuffer,254,0)
WMVLength=val(StatusBuffer)
mciSendStringA("play SplashMovie","",0,0)

time=MILLISECS()
DO:WAIT 1:UNTIL (MILLISECS() - time >= WMVLength)

mciSendStringA("close all","",0,0)
CLOSEDIALOG dlg,@IDOK
END

sub dlghandler
select @class
case @idinitdialog
CENTERWINDOW dlg
case @IDCLOSEWINDOW
CLOSEDIALOG dlg,@IDOK
endselect
return
endsub


NOTE: You may have to modify the MPEGVideo on line 12, depending on what is specified in your MCI Extensions in your win.ini file, but generally it should work with MPEGVideo.

EDIT: Added a needed WAIT 1 in the DO UNTIL Loop

LarryMc

Now does everyone see why we said it's good to see ZD back! ;D

LarryMc
LarryMc
Larry McCaughn :)
Author of IWB+, Custom Button Designer library, Custom Chart Designer library, Snippet Manager, IWGrid control library, LM_Image control library

ZeroDog

 :)

I'm sure if I didn't whip up that sample quickly, someone else would have.  ;)

LarryMc

Quote from: ZeroDog on April 06, 2012, 08:04:07 PM
:)

I'm sure if I didn't whip up that sample quickly, someone else would have.  ;)
Obviously it wasn't going to be me!  :D
Keep the code coming! ;D

lARRYmC
LarryMc
Larry McCaughn :)
Author of IWB+, Custom Button Designer library, Custom Chart Designer library, Snippet Manager, IWGrid control library, LM_Image control library

Bruce Peaslee

Quote from: ZeroDog on April 06, 2012, 08:04:07 PM
:)

I'm sure if I didn't whip up that sample quickly, someone else would have.  ;)

Maybe so, and then again maybe not. I couldn't find anything like it and I'm sure happy you knew what to do.

Thanks
Bruce Peaslee
"Born too loose."
iTired (There's a nap for that.)
Well, I headed for Las Vegas
Only made it out to Needles

Brian

Hi,

Been watching this thread - the wmv player is really neat. I found this code to
play an avi file (ZeroDog again?), although I don't really know who wrote it

Brian

ZeroDog

It's the same basic code to play an AVI.  The MCI API can be used to play almost any multimedia files, such as MIDI, MP3, AVI, MPEG, and WMV, so long as the file type is registered in the MCI Extensions section in your win.ini file.  I've used the MCI API in many projects, such as TrayPlayer, Runetabber, and even within DirectX/Direct3D screens.