Windows Media Player 11 in Delphi

Posted on: Wed, 06/25/2008 - 17:31 By: dae

Currently, I am working on a Delphi project that requires movie playing in the application. Obviously, the direct approach is to use the Windows Media Player ActiveX. However, when I imported the active X and try to resizing it at runtime, strange behavior starts to happen: the control does not obey my command. After googling around, it is that I have to directly call the SetObjectRects method directly. This could be done by the following codes.

procedure TGraphicController.resize;
    IID_IOleInPlaceObject: TGUID = '{00000113-0000-0000-C000-000000000046}';
  IOIPObj: IOleInPlaceObject;
  IDispatch(wmp.OleObject).QueryInterface(IID_IOleInPlaceObject, IOIPObj);
  IOIPObj.SetObjectRects(adjustedRect, adjustedRect);

The wmp is the Wrapper class of windows media player which is automatically generated and adjustedRect is the TRect structure that describe the location that I wish the control to be located at. The GUID of the interface can be found in