• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 682
  • Last Modified:

Cannot center AVI output using MMControl in program

I am writing a game using visual basic 5 SP3 on an XP Pro SP2 system that is using avi video (with sound) for different actions.  I am using the Microsoft Multimedia Control to play the AVI files.  All works well and the files play when they are supposed to but I cannot get the control to center the AVI.  No matter what I set width, height, left and top to... the AVI plays in the upper left of the screen.  I am using a 640 x 480 AVI on a screen that is 1440 x 900.  Twips per pixel is 15.  I have used formulas to calculate center screen on all my other forms and they all center nicely... just the MM Control will not.  I have tried placing my centering code before and after each step of the command codes to play the avi and nothing changes.  Any ideas?
0
phid
Asked:
phid
  • 4
  • 2
1 Solution
 
Jose ParrotGraphics ExpertCommented:
Hi,

You can use the following approach.
1. Read the AVI file to know the video size in pixels. How to at
http://msdn2.microsoft.com/en-us/library/Aa451195.aspx
2. Create a Panel object with Height and Width properties set to the above video size.
3. Centralize the Panel
4. Apply the MediaPlayer (Multimedia control) object in the Panel, aligned at top and left (default), that is, the MM->Display is the Panel.

That way, the video will be where you want, in the right size.

Jose
0
 
phidAuthor Commented:
Thanks Jose.  I tried creating a separate form, centering the form and then adding the MMControl in it to accomplish the same thing, but that didn't work.  

I hate to admit it... but I am not familiar with the Panel Object.  I tried to create one programmatically using code found on google, but I got errors when I tried to add the MMControl to it.  I cannot find much documentation on it, either.  Is this the same panel object that is referenced as part of the status bar control?  Do you know where I can find code and/or information on how it functions and how to use it?  Thanks again for your response.
0
 
Jose ParrotGraphics ExpertCommented:
Hummmm. As I use Borland Builder C++, I can create a Panel with a single click...
Not so easy in other environments, where you need to type a LOT of code...

If you are using Visual C++ (or even a non-graphics C++ development environment, as free Borland C++ compiler 5) take a look at the MSDN sample aviview.dsp and companion files.
It uses another approach, with PAVISTREAM, but not only put the AVI centralized as can resize the video frame as well.
The source for Visual C++ 6.0 (works with any C++ compiler from Windows 95 to xP) is at
samples/vc98/sdk/graphics/video/aviview of the MSDN disc.

Jose
0
Independent Software Vendors: 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!

 
Jose ParrotGraphics ExpertCommented:
Answering your question on Status Bar: no, it is not the same panel I'm talking about, althougth similar.

I have searched for the sample code I have cited in MSDN site, but it is not available anymore.

At ebay you find Microsoft MSDN Library for Visual Studio 6.0 CDs at very low prices. It worth the investment. Please note: version 6 will compile and link with open source compilers besides VS 6 and Borland C++; newer versions aren't guaranteed to integrate properly.

Jose
0
 
phidAuthor Commented:
I ended up using the Windows Media Player control (after hours of experimentation) which seems to work for my needs just fine.  It centers, plays the clips with no controls and then closes, which is what I was trying to accomplish.  I still don't know why the MMControl won't center, but I will deal with the "panel" issue when I have more time.  It sounds like something I need to familiarize myself with.  I am not sure how the rules here go... I didn't end up using your advice (although it lead me to another humbling "I don't know as much as I thought I did" experience), but your response is greatly appreciated.  I would like to give you the points anyway... if someone will tell me that that is okay to do.  Thanx again.
0
 
Jose ParrotGraphics ExpertCommented:
The component Panel (or TPanel) is a component of VCL, the propertary Visual Library from Borland, used in both Delphi and Builder C++. It is not an ActiveX components, but a native component. Unfortunately, it has no direct equivalent in MFC or other library from Microsoft. So my suggestion is applicable just in Borland environments.

By the other hand, the sample I have suggested, found in MSDN for Visual Studio 6, has exactly what you are looking for, besides others very interesting and useful features.

Jose

0

Featured Post

VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

  • 4
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now