-
1 Attachment(s)
MCI Video Wrapper
MCI Video Wrapper
Set of functions based on Multimedia Control Interface.
Include file allows to play movie files inside ThinBasic UI windows or even controls.
This function set is used in multiple ThinBasic projects, but I thought it is good idea to keep latest version on one place ... here :)
Author: Mike Hartlef, few modifications by Psch
Latest update
27-06-2008
-
Re: MCI Video Wrapper
This interface can be considered for a dedicated module.
I will see if I can work on this for next thinBasic release.
Eros
-
Re: MCI Video Wrapper
THanks Petr and Mike. Glad it will be a new module for us Eros in future releases.
-
Re: MCI Video Wrapper
Thanks Petr for the modifications. Never thought that this include file would deserve its own topic.
-
Re: MCI Video Wrapper
It does as we learn how to use a video texture with sound too for other effects, like talking big heads on screen in future Big Brother Government type games :) Always nice to see those kind of screens in movies and games at least for me... very symbolic and mood setting.
-
Re: MCI Video Wrapper
Hi Mike, Petr.
The "mciVideo.inc" file does not seem compatible with latest preview thinbasic 1.7.0.0 released 08 Nov 2008...
I get error report:
Error Code: 4
Error Description: Equal Sign Expected
Line Number: 58
Code: FUNCTION OPENMOVIE (MVHWND AS LONG, MVFILENAME AS STRING) AS LONG
Token Found: WANTREPEATMOVIE
This does not happen in TB Stable Release 1.6.0.10
Regards,
catventure.
-
Re: MCI Video Wrapper
catventure,
here it is working fine with latest thinbasic 1.7.0.0 preview version.
Example attached. Let me know if it is working on your side.
Eros
-
Re: MCI Video Wrapper
Hi Eros,
Yes. That example you posted works OK.
I will see if I can track down the source of the problem.
Cheers,
catventure.
-
Re: MCI Video Wrapper
Hi Catventure,
the include file works for me too.
It must be something before you include it ( maybe ? ).
Petr
-
1 Attachment(s)
Hi,
This wrapper is great for use in TAB adventure writing program and allows the writer/creator ro make .wmv video files to show in games.
On Vista I can play different size vids in my program and youtube vids for instance as long as they converted in .wmv format for the mcivideo.INC commands to work.
And they are positioned and sized correctly by my below bits of code.
HOWEVER - For some reason that I can't figure this code is not displaying the video in the box at the correct size or position in the demo I posted on some people's systems!!
Code:
'Plays movie in listview control
'========================
'========================
IF INSTR( checkact, "playmovie2" ) = 1 AND displaymode = 2 THEN
Local filename As String
filename = APP_SourcePath + gfxfolder + Mid$( checkact, 11 )
IF FILE_EXISTS( filename ) = %FALSE THEN
MSGBOX hwnd, filename + " does not exist.", %MB_ICONERROR OR %MB_OK, "TAB Warning"
EXIT FUNCTION
ELSE
Local hCanvas As Long
Control Handle hwnd, %id_listview2 To hCanvas
Local twidth, theight As Long
Dialog Get Size hcanvas To twidth, theight
MENU SET STATE hpopup1, BYCMD %ID_OPEN, %MF_DISABLED OR %mf_grayed
MENU SET STATE hpopup1, BYCMD %ID_NEWGAME, %MF_DISABLED OR %mf_grayed
MENU SET STATE hpopup1, BYCMD %ID_SAVEGAME, %MF_DISABLED OR %mf_grayed
MENU SET STATE hpopup1, BYCMD %ID_LOADGAME, %MF_DISABLED OR %mf_grayed
MENU SET STATE hpopup1, BYCMD %transcript, %MF_DISABLED OR %mf_grayed
MENU Set State hpopup1, ByCMD %transcriptoff,%MF_DISABLED Or %MF_GRAYED
MENU Set State hpopup1, ByCMD %id_exitgame, %MF_DISABLED Or %MF_GRAYED
OpenMovie( hCanvas, filename )
PlayMovie( )
PlaceMovie( 0, 0, twidth*2, theight*2 )
movieon = 1
Dialog Disable hwnd
Do
Control Set Focus hwnd,%id_richedit4
IF GETWINDOWKEYSTATE( hwnd, %vk_escape ) THEN
videoescapekey
EXIT DO
END IF
If IsMoviePlaying( ) = %FALSE And movieon > 0 Then
videoescapekey
END IF
LOOP UNTIL movieon = 0
EXIT FUNCTION
END IF
END IF
'==========================
Code:
' Tried using label control INSTEAD and also with label control on top of listview control as below
'Plays movie in LABEL control overlaid over listbox control
'==============================================
'===============================================
IF INSTR( checkact, "playmovie2" ) = 1 AND displaymode = 2 THEN
Local filename As String
filename = APP_SourcePath + gfxfolder + Mid$( checkact, 11 )
IF FILE_EXISTS( filename ) = %FALSE THEN
MSGBOX hwnd, filename + " does not exist.", %MB_ICONERROR OR %MB_OK, "TAB Warning"
EXIT FUNCTION
ELSE
Local hCanvas As Long
Control Handle hwnd, %id_listview2 To hCanvas
Local twidth, theight, xloc, yloc As Long
Dialog Get Size hcanvas To twidth, theight
Dialog Get Loc hcanvas To xloc, yloc
Control Add Label, hwnd, %ID_textview, "", xloc, yloc, twidth, theight, %SS_BITMAP
'
Control Handle hwnd, %id_textview To hCanvas
MENU SET STATE hpopup1, BYCMD %ID_OPEN, %MF_DISABLED OR %mf_grayed
MENU SET STATE hpopup1, BYCMD %ID_NEWGAME, %MF_DISABLED OR %mf_grayed
MENU SET STATE hpopup1, BYCMD %ID_SAVEGAME, %MF_DISABLED OR %mf_grayed
MENU SET STATE hpopup1, BYCMD %ID_LOADGAME, %MF_DISABLED OR %mf_grayed
MENU SET STATE hpopup1, BYCMD %transcript, %MF_DISABLED OR %mf_grayed
MENU Set State hpopup1, ByCMD %transcriptoff,%MF_DISABLED Or %MF_GRAYED
MENU Set State hpopup1, ByCMD %id_exitgame, %MF_DISABLED Or %MF_GRAYED
OpenMovie( hCanvas, filename )
PlayMovie( )
PlaceMovie( 0, 0, twidth*2, theight*2 )
movieon = 1
Dialog Disable hwnd
CONTROL DISABLE hwnd, %id_textbox2
DO
IF GETWINDOWKEYSTATE( hwnd, %vk_escape ) THEN
videoescapekey
EXIT DO
END IF
IF IsMoviePlaying( ) = %false AND movieon > 0 THEN
closemovie( )
movieon = 0
dialog enable hwnd
MENU SET STATE hpopup1, BYCMD %ID_OPEN, %MF_ENABLED
MENU SET STATE hpopup1, BYCMD %ID_NEWGAME, %MF_ENABLED
MENU SET STATE hpopup1, BYCMD %ID_SAVEGAME, %MF_ENABLED
MENU SET STATE hpopup1, BYCMD %ID_LOADGAME, %MF_ENABLED
MENU SET STATE hpopup1, BYCMD %transcript, %MF_ENABLED
MENU Set State hpopup1, ByCMD %transcriptoff, %MF_ENABLED
MENU Set State hpopup1, ByCMD %id_exitgame, %MF_ENABLED
CONTROL KILL hwnd, %id_textview
CONTROL ENABLE hwnd, %id_textbox2
GETWINDOWKEYSTATE( hwnd, - 1 )
CONTROL SET TEXT hwnd, %id_textbox2, ""
CONTROL SET FOCUS hwnd, %id_textbox2
END IF
LOOP UNTIL movieon = 0
EXIT FUNCTION
END IF
END IF
'==========================
Eros, Petr or Michael,
Can you cast an eye over the code I posted and detect if I did something wrong when calling the video routines for placing and sizing the video?
Works great on mine (Vista) and vids, small or large or perfectly sized into graphicbox control like in lower box of the image attached:
Attachment 10221
catventure.
PS. It requires the "winmm.dll" to be present in the users system32 folder! Would the mcivideo.INC still in fact work on windows 7 or 10?
I wanted my program to work on all windows from XP onwards that why I am still using older version of thinbasic to keep compatibility with XP
Any help appreciated.