Can I pick the size and position of an avi file?

S

ste mac

Hi Guys, the code below was kindly posted by Michel Pierron...

It works fine, but I really wanted it to run in it own window
so the spreadsheet can be seen behind the avi...How do I adjust
the code to do this? can I pick the avi window size/position?

Thanks for any help....
ste

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

Sub FullScreenAvi()
Const aviFile = "C:\Clock.avi" ' Modify as appropriate
Dim Cmd As String
Cmd = "play " & aviFile & " fullscreen "
mciSendString Cmd, 0&, 0, 0&
End Sub
 
I

Ivan F Moala

something like;

Declare Function mciSendString _
Lib "winmm" _
Alias "mciSendStringA" ( _
ByVal lpstrCommand As String, _
ByVal lpstrReturnStr As Any, _
ByVal wReturnLen As Long, _
ByVal hCallBack As Long) _
As Long

Declare Function GetActiveWindow Lib "USER32" () As Integer

Const WS_CHILD = &H40000000

Sub PlayAVIFile()
Dim CmdStr As String, FileSpec As String
Dim Ret As Long, XlShwnd As Long

'The name and location of the AVI file to play.
FileSpec = "C:\AVI\Files\E-Mail\Scanemail.avi"

'Get the active sheet's window handle.
XlShwnd = GetActiveWindow()

'Opens the AVIVideo and creates a child window on the sheet
'where the video will display. "Animation" is the device_id.
CmdStr = ("open " & FileSpec & " type AVIVideo alias animation parent " & _
LTrim(Str(XlShwnd)) & " style " & LTrim(Str(WS_CHILD)))

Ret = mciSendString(CmdStr, 0&, 0, 0)

'Put the AVI window at location 50, 50 relative to the
'parent window (Microsoft Excel) with a size of 260 x 160.
Ret = mciSendString("put animation window at 50 50 260 160", 0&, 0, 0)

'The wait tells the MCI command to complete before returning
'control to the application.
Ret = mciSendString("play animation wait", 0&, 0, 0)

'Close windows.
Ret = mciSendString("close animation", 0&, 0, 0)


End Sub
 

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