mmcontrol with video

loko_sharings
loko_sharings used Ask the Experts™
on
I'm using mmcontrol to play video, it works great, but in some computers, the video is not played inside my "picture1" window, but in a new one that pops on the screen. This is the code i use:

'---- GLOBAL DECLARATIONS
#If Win32 Then
    Private 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
#Else
    Private Declare Function mciSendString Lib "mmsystem" (ByVal lpstrCommand As String, ByVal lpstrReturnString As String, ByVal uReturnLength As Integer, ByVal hWndCallback As Integer) As Long
#End If

'--- Function
Picture1.Visible = True
MMControl1.Notify = True
MMControl1.Wait = False
MMControl1.Shareable = False
MMControl1.DeviceType = "AVIVideo"
MMControl1.FileName = "video.avi"
MMControl1.Command = "Open"
'Put window handle in CmdStr$
CmdStr$ = "window " + MMControl1.FileName + " handle " + Format$(Picture1.hWnd)
'Send window handle to mciSendString
ReturnVal& = mciSendString(CmdStr$, 0&, 0, 0&)
'Put output in window
CmdStr$ = "put " + MMControl1.FileName + " destination "
ReturnVal& = mciSendString(CmdStr$, 0&, 0, 0&)
MMControl1.Command = "Prev"
MMControl1.Command = "Play"

How can I do it to put the video inside my picture1 window always, even if im at another computer? do i have to include any file with my program (apart from the MCI32.OCX file?)
Comment
Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®
You can force the window to be hosted by your picturebox using the SetParent API.  You need the handle of the window it creates which can be obtained using the FindWindow API if you don't already have it.

Both declarations are included here:
Public Declare Function SetParent Lib "user32" Alias "SetParent" (ByVal hWndChild As Long, ByVal hWndNewParent As Long) As Long

Public Declare Function FindWindow Lib "user32" Alias "FindWindowA" (ByVal lpClassName As String, ByVal lpWindowName As String) As Long



Author of the Year 2009

Commented:
Hi loko_sharings,
It appears that you have forgotten this question. I will ask Community Support to close it unless you finalize it within 7 days. I will ask a Community Support Moderator to:

    Accept twalgrave's comment(s) as an answer.

loko_sharings, if you think your question was not answered at all or if you need help, just post a new comment here; Community Support will help you.  DO NOT accept THIS comment as an answer.
==========
DanRollins -- EE database cleanup volunteer

Do more with

Expert Office
Submit tech questions to Ask the Experts™ at any time to receive solutions, advice, and new ideas from leading industry professionals.

Start 7-Day Free Trial