Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

WMP 11 sizing problem (Delphi 7)

239 views
Skip to first unread message

Jeff

unread,
Jan 2, 2008, 11:53:15 AM1/2/08
to
Hi,

I'm migrating a D7 application to Vista that uses the windows media
player 6.4 activex control. Since Vista no longer includes te 6.4
player (mplayer2.exe), the compatibility mode of version 11 is
automatically invoked.

In an open dialog component I created that includes the WMP control to
preview videos, the WMP control is resizing itself to the origianl
size of the video and is not reflecting the width, height, or align
properties that I assign to the control. My dialog component is
similar to the Delphi TOpenPictureDialog dialog in that the preview
area controls (including the WMP control) are added via code at
runtime.

Another unit in my project that uses a WMP control established in
design mode DOES correctly resize the video to fit within the WMP
control's bounds.

I've seen some older posts suggesting some possible work arounds
(i.e., IOleInPlaceObject.SetObjectRects, first setting the wmp's
parent to null, etc.) but nothing seems to work for me. The WMP
control is always sized to fit the video's original size as if I
clicked the "Fit player to video on start" option within the actual
windows media player 11 application's video size menu.

I also tried importing the WMP11 activex control (WMPLib_TLB) and
using it, but encounterd the exact same behavior.

Does anyone have any suggestions on how I can get the WMP control to
correctly size itself via code and stretch the video to fit within the
sized WMP's bounds?

Thanks,
Jeff

Jeff

unread,
Jan 8, 2008, 9:23:22 AM1/8/08
to
One solution that I have discovered to my WMP video sizing issue is to
import the WMPLib_TLB, cast the 6.4 media player's OleObject, and then
set the player's UIMode property to "mini". The code below is
included in the method that I use to create the 6.4 WMP. If 6.4 isn't
installed (i.e. Vista), then the 6.4 media player object is cast to
the version 11 media player.

// Cast the 6.4 Media Player to WMP11 and set uiMode.
// This gets around the resizing issue with Vista and WMP 11.
if IsWMP64Installed = False then // Custom method to determine if
wmp version is 6.4
begin
with FMediaPlayer do
(IDispatch(OleObject) as IWMPPlayer4).uiMode:='mini';
end;

Using the above approach, the video is correctly sized to fit the wmp
object's bounds. In my case the wmp object is located within a panel
and the wmp object's align property is set to alClient.

I still would be interested to learn if anyone knows of a way to
properly fit the video within a sized 6.4 wmp object without
explicitly casting it to IWMPPlayer4.

Thanks,
Jeff

0 new messages