Solved

VB4/16 BIT/hWndDisplay/AVI

Posted on 1997-07-08
3
352 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 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: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering 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

Suggested Solutions

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 …
Since upgrading to Office 2013 or higher installing the Smart Indenter addin will fail. This article will explain how to install it so it will work regardless of the Office version installed.
Get people started with the process of using Access VBA to control Excel using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Excel. Using automation, an Access application can laun…
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…

749 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