Solved

VB4/16 BIT/hWndDisplay/AVI

Posted on 1997-07-08
3
348 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
ID: 1428102
Have you tried to change the PictureBox to AutoSize?
0
 
LVL 1

Accepted Solution

by:
lmarceau earned 70 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

Free Tool: Postgres Monitoring System

A PHP and Perl based system to collect and display usage statistics from PostgreSQL databases.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Have you ever wanted to restrict the users input in a textbox to numbers, and while doing that make sure that they can't 'cheat' by pasting in non-numeric text? Of course you can do that with code you write yourself but it's tedious and error-prone …
Background What I'm presenting in this article is the result of 2 conditions in my work area: We have a SQL Server production environment but no development or test environment; andWe have an MS Access front end using tables in SQL Server but we a…
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
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…

829 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