Solved

VB4/16 BIT/hWndDisplay/AVI

Posted on 1997-07-08
3
330 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
3 Comments
 
LVL 7

Expert Comment

by:tward
Comment Utility
Have you tried to change the PictureBox to AutoSize?
0
 
LVL 1

Accepted Solution

by:
lmarceau earned 70 total points
Comment Utility
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
Comment Utility
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

How to improve team productivity

Quip adds documents, spreadsheets, and tasklists to your Slack experience
- Elevate ideas to Quip docs
- Share Quip docs in Slack
- Get notified of changes to your docs
- Available on iOS/Android/Desktop/Web
- Online/Offline

Join & Write a Comment

I’ve seen a number of people looking for examples of how to access web services from VB6.  I’ve been using a test harness I built in VB6 (using many resources I found online) that I use for small projects to work out how to communicate with web serv…
Most everyone who has done any programming in VB6 knows that you can do something in code like Debug.Print MyVar and that when the program runs from the IDE, the value of MyVar will be displayed in the Immediate Window. Less well known is Debug.Asse…
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…

772 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

Need Help in Real-Time?

Connect with top rated Experts

12 Experts available now in Live!

Get 1:1 Help Now