Click here to Skip to main content
15,881,852 members
Articles / Mobile Apps / Windows Mobile

ATL Windowless ActiveX Media Container

Rate me:
Please Sign up or sign in to vote.
5.00/5 (20 votes)
5 Mar 2009Apache7 min read 176.9K   8.1K   100  
Full-fledged ATL Windowless ActiveX Container. Ideal for hosting Windows Media Player, Transparent Flash and Silverlight Animations.
//------------------------------------------------------------------------
//
//  Copyright (c) 2005  Microsoft Corporation
//
//  Abstract:
//
//      IDL file for activex control
//
//
//------------------------------------------------------------------------
//

#include "olectl.h"
#include "controlids.h"
import "oaidl.idl";
import "ocidl.idl";

[
    object,
    uuid(EE38D0F1-5AE3-408c-A6BF-8410E645F376),
    dual,
    nonextensible,
    helpstring("IXcpObject Interface"),
    pointer_default(unique)
]
interface IXcpObject : IDispatch
{
};


[
    object,
    uuid(1FB839CC-116C-4C9B-AE8E-3DBB6496E326),
    dual,
    nonextensible,
    helpstring("IXcpControl Interface"),
    pointer_default(unique)
]
interface IXcpControl : IDispatch
{
    [propget, bindable, requestedit, id(DISPID_XCPCTRL_SOURCE)]
    HRESULT Source([out, retval]  BSTR *pstr);
    [propput, bindable, requestedit, id(DISPID_XCPCTRL_SOURCE)]
    HRESULT Source([in] BSTR str);

    [propget, bindable, requestedit, id(DISPID_XCPCTRL_LOADED)]
    HRESULT IsLoaded([out, retval]  VARIANT_BOOL *pb);


    [propget, bindable, requestedit, id(DISPID_XCPCTRL_CONTENT)]
    HRESULT Content([out, retval]  IDispatch **ppContent);

    [propget, bindable, requestedit, id(DISPID_XCPCTRL_SETTINGS)]
    HRESULT Settings([out, retval]  IDispatch **ppSettings);

    [propget, bindable, requestedit, id(DISPID_XCPCTRL_ONLOADED)]
    HRESULT OnLoad([out, retval] VARIANT* pVAR);
    [propput, bindable, requestedit, id(DISPID_XCPCTRL_ONLOADED)]
    HRESULT OnLoad([in] VARIANT* pVAR);

    [propget, bindable, requestedit, id(DISPID_XCPCTRL_ONERROR)]
    HRESULT OnError([out, retval] VARIANT* pVAR);
    [propput, bindable, requestedit, id(DISPID_XCPCTRL_ONERROR)]
    HRESULT OnError([in] VARIANT* pVAR);

    HRESULT CreateObject([in] BSTR id, [out, retval] IXcpObject** ppDisp);

    HRESULT IsVersionSupported([in] BSTR v, [out, retval] VARIANT_BOOL *pb);

    [propget, bindable, requestedit, id(DISPID_XCPCTRL_INITPARAMS)]
    HRESULT InitParams([out, retval] BSTR * initparams);
    [propput, bindable, requestedit, id(DISPID_XCPCTRL_INITPARAMS)]
    HRESULT InitParams([in] BSTR initparams);
};

[
    object,
    uuid(1c3294f9-891f-49b1-bbae-492a68ba10cc),
    dual,
    nonextensible,
    helpstring("IXcpControl2 Interface"),
    pointer_default(unique)
]
interface IXcpControl2 : IXcpControl
{
    HRESULT LoadRuntime();

    [propget, bindable, requestedit, id(DISPID_XCPCTRL_SPLASHSCREENSOURCE)]
    HRESULT SplashScreenSource([out, retval]  BSTR *pstr);
    [propput, bindable, requestedit, id(DISPID_XCPCTRL_SPLASHSCREENSOURCE)]
    HRESULT SplashScreenSource([in] BSTR str);

    [propget, bindable, requestedit, id(DISPID_XCPCTRL_ONSOURCEDOWNLOADCOMPLETE)]
    HRESULT OnSourceDownloadComplete([out, retval] VARIANT* pVAR);
    [propput, bindable, requestedit, id(DISPID_XCPCTRL_ONSOURCEDOWNLOADCOMPLETE)]
    HRESULT OnSourceDownloadComplete([in] VARIANT* pVAR);

    [propget, bindable, requestedit, id(DISPID_XCPCTRL_ONSOURCEDOWNLOADPROGRESSCHANGED)]
    HRESULT OnSourceDownloadProgressChanged([out, retval] VARIANT* pVAR);
    [propput, bindable, requestedit, id(DISPID_XCPCTRL_ONSOURCEDOWNLOADPROGRESSCHANGED)]
    HRESULT OnSourceDownloadProgressChanged([in] VARIANT* pVAR);
};

[
    object,
    uuid(2E340632-5D5A-427b-AC31-303F6E32B9E8),
    nonextensible,
    helpstring("IXcpControlDownloadCallback Interface"),
    pointer_default(unique)
]
interface IXcpControlDownloadCallback : IUnknown
{
    HRESULT OnUrlDownloaded(HRESULT hr, IStream* pStream);
};

[
    object,
    uuid(1B36028E-B491-4bb2-8584-8A9E0A677D6E),
    nonextensible,
    helpstring("IXcpControlHost Interface"),
    pointer_default(unique)
]
interface IXcpControlHost : IUnknown
{
    typedef enum
    {
        XcpHostOption_FreezeOnInitialFrame       = 0x001,
        XcpHostOption_DisableFullScreen          = 0x002,
        XcpHostOption_DisableManagedExecution    = 0x008,
        XcpHostOption_EnableCrossDomainDownloads = 0x010,
        XcpHostOption_UseCustomAppDomain         = 0x020,
        XcpHostOption_DisableNetworking          = 0x040,        
        XcpHostOption_DisableScriptCallouts      = 0x080,
        XcpHostOption_EnableHtmlDomAccess        = 0x100,
        XcpHostOption_EnableScriptableObjectAccess = 0x200,
    } XcpHostOptions;

    HRESULT GetHostOptions([out, retval] DWORD* pdwOptions);

    HRESULT NotifyLoaded();

    HRESULT NotifyError([in] BSTR bstrError, [in] BSTR bstrSource, [in] long nLine, [in] long nColumn);

    HRESULT InvokeHandler([in] BSTR bstrName, [in] VARIANT varArg1, [in] VARIANT varArg2, [out, retval] VARIANT* pvarResult);

    HRESULT GetBaseUrl([out, retval] BSTR* pbstrUrl);

    HRESULT GetNamedSource([in] BSTR bstrSourceName, [out, retval] BSTR* pbstrSource);

    //
    // Called by Silverlight to allow a host to provide content for a specified URI. This is useful in cases
    // where a resource would normally be loaded out of a XAP at runtime. At design time, no XAP exists, and
    // the host can provide content for that resource.
    //
    // This method can work synchronously or asynchronously. If the pCallback parameter is NULL, the host must
    // do the work synchronously and return the result in ppStream. If the pCallback parameter is non-NULL, the host
    // may do the work synchronously or asynchronously, invoking callback methods as defined by the 
    // IXcpControlDownloadCallback interface. If the host chooses to work asyncronously, the ppStream parameter is
    // ignored.
    //
    // The host should return S_FALSE if it cannot provide a resource for the requested URI, and S_OK on a
    // successful request.
    //
    HRESULT DownloadUrl([in] BSTR bstrUrl, [in] IXcpControlDownloadCallback* pCallback, [out, retval] IStream** ppStream);

};

[
    object,
    uuid(fb3ed7c4-5797-4b44-8695-0c512ea27d8f),
    nonextensible,
    helpstring("IXcpControlHost2 Interface"),
    pointer_default(unique)
]
interface IXcpControlHost2 : IXcpControlHost
{
    HRESULT GetCustomAppDomain([out, retval] IUnknown** ppAppDomain);

    HRESULT GetControlVersion([out] UINT *puMajorVersion, [out] UINT *puMinorVersion);
};

[
    uuid(283C8576-0726-4DBC-9609-3F855162009A),
    version(2.0),
    helpstring("AgControl 2.0 Type Library"),
    control
]
library XcpControlLib
{
    importlib("stdole2.tlb");
    [
        uuid(DFEAF541-F3E1-4c24-ACAC-99C30715084A),
        helpstring("AgControl Class")
    ]
    coclass XcpControl
    {
        [default] interface IXcpControl2;
        interface IXcpControl;
    };
};

By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.

If a file you wish to view isn't highlighted, and is a text file (not binary), please let us know and we'll add colourisation support for it.

License

This article, along with any associated source code and files, is licensed under The Apache License, Version 2.0


Written By
Software Developer (Senior)
United States United States
Ernest is a multi-discipline software engineer.
Skilled at software design and development for all Windows platforms.
-
MCSD (C#, .NET)
Interests: User Interface, GDI/GDI+, Scripting, Android, iOS, Windows Mobile.
Programming Skills: C/C++, C#, Java (Android), VB and ASP.NET.

I hope you will enjoy my contributions.

Comments and Discussions