Tags
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;
const
IID_IOleInPlaceObject: TGUID = '{00000113-0000-0000-C000-000000000046}';
var
IOIPObj: IOleInPlaceObject;
begin
inherited;
IDispatch(wmp.OleObject).QueryInterface(IID_IOleInPlaceObject, IOIPObj);
IOIPObj.SetObjectRects(adjustedRect, adjustedRect);
end;
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 http://msdn.microsoft.com/en-us/library/bb180708(VS.80).aspx.
- Log in to post comments
test