Re: WMP control resizing

Tech-Archive recommends: Repair Windows Errors & Optimize Windows Performance



Yes, I did actually try it, but as I said, I used VS 2003. I don't have an
installation of VC6 handy. As I said, things tend to change from version to
version.

"D-Code-99" wrote:

> Jim, thanks for your reply.
>
> Let me clarify further. I understand how things work re: MFC, ActiveX
> control wrapping etc. I'm using VC6. I don't have any problems whatsoever in
> getting the WMP9 activex control in a window and playing movies etc. You said:
>
> > Now to the point: when you want to resize the control (any control) in MFC,
> > you really want to resize the container window. The container window (CWnd
> > class) is provided by MFC,
>
> Can I ask, have you actually tried this? Resizing the CWnd does not resize
> the activex control. You can move the window with no problems, but the
> control absolutely will not resize.
>
> Here's an example. I attach a CWnd to a standard HWND and can manipulate it
> absolutely perfectly - resizing, moving etc. I then use the CMediaPlayer4
> class to dynamically create (CMediaPlayer4::Create()) itself with the CWnd as
> the parent window. No problem here.
>
> I build and run the code, and I can drag the window to a new location. I can
> also set the window position programmatically (SetWindowPos etc).
>
> However when I try to resize the window, the CWnd resizes but the activex
> control does not. The same occurs when trying to use SetWindowPos etc to
> resize the window.
>
> No matter what I do, I cannot get the activex control to resize itself as
> the parent window is resized. It's very easy to reproduce this problem:
>
> 1. Make app (dialog, view, anything you like)
> 2. Add WMP9 activex control and generate CMediaPlayer4
> 3a. If necessary, attach a CWnd to the HWND of the window.
> 3b. In code, call CMediaPlayer4::Create() to create the control.
> 4. Try to resize the window either in code or at runtime through the UI
>
> Everything I have found (including a post from yourself from 2003) indicates
> that the only way to get the control (/movie) to resize itself at runtime is
> via a skin.
>
> If I'm wrong and there is a way, great - I'd be happy to use that. My
> question would then be - "how do I do this".
>
> If I'm right, I'll have to use skins. My question would then be - "How do I
> access/connect to/use the WMP9 skins interface from an MFC app that currently
> has a CMediaPlayer class"?
>
> I have everything else working. All I need to do is to resize the control at
> runtime (or rather, allow the user to resize it). Thanks for your help.
>
>
>
> "Jim Travis [ms]" wrote:
>
> > I'll try to help.
> >
> > First, you don't state which version of Visual Studio you're using, so I can
> > really only speak generically. The way things work in VS, MFC, ATL, and so
> > forth can change in meaningful ways from version to version.
> >
> > In general, the WMP control is an ActiveX control, and MFC supports hosting
> > ActiveX controls, as does ATL, or IE, or VB...you get the idea. Each of
> > these technologies has its own way of exposing the hosting of these
> > controls. While the Player SDK tries to provide useful information about how
> > to get started in each of these areas, it is beyond the scope of the Player
> > SDK to provide all the possible information one might want to know about how
> > to host the control in each technology. It is even less possible to track
> > all the changes that happen in these areas from version to version; one must
> > look to the technology-specific documentation for that information.
> >
> > This means, as a practical matter, the Player SDK mostly has to stay focused
> > on Player-specific information. To do that, we provide some sample code, and
> > we've chosen ATL as the preferred technology to use for that purpose for C++
> > programmers, because it provides the most concise coding paradigm and it is
> > particularly well suited to working with ActiveX/COM. But you shouldn't look
> > to the Player SDK documentation to educate you about ATL, MFC (or any other
> > programming framework), or ActiveX controls in general.
> >
> > Now to the point: when you want to resize the control (any control) in MFC,
> > you really want to resize the container window. The container window (CWnd
> > class) is provided by MFC, not the Player SDK. In Visual Studio .NET 2003, I
> > find that I can simply call CWnd::MoveWindow(0,0,100,100) through my
> > reference to CWMPPlayer4 (because the wrapper derives from CWnd) and the
> > control's UI moves and resizes. I also find that I need to call
> > this->RedrawWindow() to get the dialog to repaint properly.
> >
> > Hope that helps.
> >
> > --
> > Jim Travis
> > Microsoft Corp.
> > Windows Media Player SDK
> >
> > Download:
> > http://msdn.microsoft.com/library/default.asp?url=/downloads/list/winmedia.asp
> >
> > Latest online:
> > http://msdn.microsoft.com/library/en-us/wmplay10/mmp_sdk/windowsmediaplayer10sdk.asp
> >
> > Please do not send email directly to this alias as this alias is for
> > newsgroup purposes only. This posting is provided "AS IS" with no
> > warranties, and confers no rights. You assume all risk for your use. © 2005
> > Microsoft Corporation. All rights reserved.
> >
> > "D-Code-99" <DCode99@xxxxxxxxxxxxxxxxxxxxxxxxx> wrote in message
> > news:C7A60AF1-9B10-450E-9A78-709A7046E9D9@xxxxxxxxxxxxxxxx
> > > Hi,
> > >
> > > I've successfully got the WMP9 activex control created dynamically and
> > > attached to a generic window at runtime. For various reasons I'm using MFC
> > > and CWMPPlayer4 wrapper. Playback etc etc all works correctly.
> > >
> > > However it seems it's not possible to resize the control at runtime
> > > through
> > > the standard interface. Apparently the only way to do it is via skins.
> > > I've
> > > been looking into this for hours now, and the only information I can find
> > > is
> > > cryptic statements from some guy at MS in 2003.
> > >
> > > I can't understand how to implement WMP9 skins in an MFC app. I've looked
> > > at
> > > the RemoteSkin sample - it's ATL, not MFC and it's of no help at all.
> > > Really
> > > I don't even want to implement skins, I just want to be able to resize the
> > > control (and therefore the video output) at run-time. This seems like such
> > > a
> > > simple, basic requirement...
> > >
> > > Can anyone help before I go nuts? The WMP SDK documentation is awful.
> > >
> > > Thanks!
> >
> >
> >
.



Relevant Pages