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!!
'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
'==========================
' 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:
vert_display.jpg
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.
Bookmarks