?
Solved

VB4/16 BIT/hWndDisplay/AVI

Posted on 1997-07-08
3
Medium Priority
?
377 Views
Last Modified: 2006-11-17
I am using the hWndDisplay property of a multimedia control to display AVIs in a picture box.  The AVI to be displayed is selected by the user from a list.  I would like to automatically adjust the size of the picture box to fit the AVI, but I don't know what aspect/property of the AVI to address.  Is there a way to do this?  
0
Comment
Question by:STKeith
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
3 Comments
 
LVL 7

Expert Comment

by:tward
ID: 1428102
Have you tried to change the PictureBox to AutoSize?
0
 
LVL 1

Accepted Solution

by:
lmarceau earned 210 total points
ID: 1428103
Send mci command to the Avi to resize to coordinates you will give it (in pixels).
I've also paste how do I place the Avi on a windows since  don't know how you did it. (You would be nice to tell me.)
Here is the code:

===========================
Declare Function mciSendCommand Lib "winmm.dll" Alias "mciSendCommandA" (ByVal wDeviceID As Long, ByVal uMessage As Long, ByVal dwParam1 As Long, ByRef dwParam2 As Any) As Long
    Public Const MCI_WINDOW = &H841
        Public Const MCI_OVLY_WINDOW_ENABLE_STRETCH = &H100000
        Public Const MCI_OVLY_WINDOW_HWND = &H10000
        Type MCI_OVLY_WINDOW_PARMS
            dwCallback As Long
            hwnd As Long
            nCmdShow As Long
            lpstrText As String
        End Type
    Public Const MCI_PUT = &H842
        Public Const MCI_OVLY_PUT_DESTINATION = &H40000
        Public Const MCI_OVLY_RECT = &H10000
        Type MCI_OVLY_RECT_PARMS
            dwCallback As Long
            rc As RECT
        End Type



Dim API As Integer
Dim AviWindows As MCI_OVLY_WINDOW_PARMS
Dim AviPutRect As MCI_OVLY_RECT_PARMS
        'Put in Window
            AviWindows.hwnd = frmMain.hwnd
            AviWindows.dwCallback = frmMain.hwnd
            API = mciSendCommand(frmMain.MMCtrl.DeviceID, MCI_WINDOW, MCI_OVLY_WINDOW_ENABLE_STRETCH + MCI_OVLY_WINDOW_HWND, AviWindows)
        'Scale to full Windows
           
            AviPutRect.rc.Bottom = frmMain.ScaleHeight
            AviPutRect.rc.Top = 0
            AviPutRect.rc.Left = 0
            AviPutRect.rc.Right = frmMain.ScaleWidth
            AviPutRect.dwCallback = frmMain.hwnd
            API = mciSendCommand(frmMain.MMCtrl.DeviceID, MCI_PUT, MCI_OVLY_PUT_DESTINATION + MCI_OVLY_RECT, AviPutRect)
===================================


0
 

Author Comment

by:STKeith
ID: 1428104
I placed the AVI into the picture box with the following code:
MMControl1.hWndDisplay = Picture1.hWnd
MMControl1.command = "open"
MMControl1.command = "play"

P.S.  I tried setting the picture box autosize property to True, but apparantly that only works for graphics and not AVIs.
0

Featured Post

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction While answering a recent question (http://www.experts-exchange.com/Q_27402310.html) in the VB classic zone, I wrote some VB code in the (Office) VBA environment, rather than fire up my older PC.  I didn't post completely correct code o…
When trying to find the cause of a problem in VBA or VB6 it's often valuable to know what procedures were executed prior to the error. You can use the Call Stack for that but it is often inadequate because it may show procedures you aren't intereste…
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…
This lesson covers basic error handling code in Microsoft Excel using VBA. This is the first lesson in a 3-part series that uses code to loop through an Excel spreadsheet in VBA and then fix errors, taking advantage of error handling code. This l…
Suggested Courses

770 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question