Professional UI Solutions
Site Map   /  Register
 
 

Forum

Please Log In to post a new message or reply to an existing one. If you are not registered, please register.

NOTE: Some forums may be read-only if you are not currently subscribed to our technical support services.

Forums » Prof-UIS Tech Support » ProfUIS 2.84: Inserted Active/X control does no show up in CExtResizableDialog VS 9 (2008) builds Collapse All
Subject Author Date
Michael Galperin Dec 24, 2008 - 12:14 AM

I’m on Vista Ultimate OS. I have both VS 6 and VS 2008.  


Open Sample "Solution for Visual Studio 9.0 (2008) - Win32 platform"

1. Make ProfUIS_Controls sample project your Startup project

2. Edit resource and open IDD_PROFUIS_CONTROLS_DIALOG 

3. Resize it to allow room for an active X (media player) control

4. Right-click and "Insert an Active/X control..."

5. Pick "Windows Media Player"

6. Compile, and Run

7. The embedded Windows Media Player does not appear!


Now open the "Workspace for Visual Studio 6 with SP6"

1. Make ProfUIS_Controls sample project your Startup project

2. Edit resource and open IDD_PROFUIS_CONTROLS_DIALOG 

3. (The "Windows Media Player" is already there since we’ve arleady added above)

4. Compile, and Run

5. The embedded Windows Media Player appears!





Actually, the error in my project is more fatal because I’m using SubclassDlgItem() which ASSERTS. If I change to DDX_Control, it does not have an error message but the control is nowhere to be seen (just like above).


Your help will be much appreciated!


Ferdie




 

Technical Support Dec 26, 2008 - 2:48 AM

We would like to provide you with additional information about the problem. If you try to play with the Disabled, enabled and WindowlessVideo properties of the Windows Media Player ActiveX control, then it may start working in the MFC 4.2 - based old version in the same way like it does in the MFC 9.0 - based modern version. It really looks like the modern version somehow switches video player into windowless mode and it’s not possible to change this mode even from code. We also noticed, that if we open the ActiveX properties dialog of the Windows Media Player control in Visual Studio 2008 (click the last toolbar button inside the property grid), change something, click OK or Apply and open properties dialog again, then not all the properties were applied. This is not happen in Visual C++ 6.0 IDE. But the small standalone test project displays the Windows Media Player ActiveX control well. So, the really working right now solution can be the following: create new child dialog and player control inside it, then create the child dialog inside other dialog. This will let the player control live inside small and friendly dialog. This also allows to avoid any potentially possible conflicts between player control and its neighborhood controls.

Michael Galperin Dec 29, 2008 - 7:14 PM

 


Thank you very much for looking into my problem.


In my application, the media player is contained in CExtResizeableDialog which is a page inserted into a CExtTabPageContainerWhidbeyWnd. So for now, I replaced the CExtResizeableDialog into just play CDialog. The control is now being displayed, BUT the problem is that I can’t resize the media player to fill the client area. 


One indicator that something is still not right is the m_hwnd member of the active/X container is still NULL. So I can’t use CWnd::MoveWindow. I also I tried using ResizeAxControl() - using IOlObject::SetExtent( DVASPECT_CONTENT, size) I found in Prof-UIS forums. It does not work either.


In summary, the control shows up but I cannot resize it. Help!


 

Technical Support Dec 31, 2008 - 2:56 AM

It looks as the following method can really affect the WMP control’s size:

http://msdn.microsoft.com/en-us/library/ms683767.aspx

At least one developer reports it works in comparison with any other APIs:

http://www.nattee.net/node/1999

Michael Galperin Dec 31, 2008 - 10:26 AM

It works! Thank you.


So the solution to my problem is:


1. Use CDialog instead of CExtResizeableDialog

2. Resize the media player activeX object using IOleInplaceObject::SetObjectRects()


Here is my function, which is called from my dialog’s OnSize() handler:


bool CMyDialog::ResizeAxControl( CWnd & wndAxControl, int cx, int cy ) {  ASSERT_VALID( this );  IUnknown * pUnknown = wndAxControl.GetControlUnknown();  if( pUnknown == NULL )   return false;

 IOleInPlaceObject * pOleInplaceObject = NULL;  hr = pUnknown->QueryInterface( __uuidof(IOleInPlaceObject), (LPVOID*)&pOleInplaceObject );  if( hr != S_OK )   return false;  ASSERT(  pOleInplaceObject != NULL );  CRect rect(0,0,cx,cy);  hr = pOleInplaceObject->SetObjectRects( &rect, &rect );  pOleInplaceObject->Release();

 // release is not required because there was no AddRef()  // pUnknown->Release();  return ( hr == S_OK ) ? true : false; }

Technical Support Dec 24, 2008 - 1:35 PM

We confirm this issue. We reproduced it using the test projects from this ZIP file:

http://www.prof-uis.com/download/forums/tmp/TestMediaPlayer.zi

Please note, the player on dialog tries to play the following URL:

http://media.rockstargames.com/flies/xbox360/640x360.wmv

The file is played with MFC 9.0-based version of the project but the player controls are not visible. It looks like the Windows Media Player control is not well compatible with double buffered painting of its parent dialog. But we did not found why this problem occurs with MFC 9.0 only. We will try to find a solution. But in any case, the Media Player control created inside standalone child dialog should not have such problem.


Michael Galperin Dec 24, 2008 - 2:24 PM

Yes, I noticed that it still can play. However, I am not able to resize to fit my dialog because the control has NULL m_hwnd.


Furthermore, my application needs the controls.


Thank you very much for looking into it. I hope you get inspired with the holiday to come up with a solution soon.