A Video for Windows ActiveX Control
by Ofer LaOr

Listing One
[
    hidden,
    uuid(54526101-F0CA-11d1-969F-002018631632)
]
dispinterface _oVFWEvents
{
    properties:
    methods:
    [id(1)] void DriversEnum([in]long index, [in]IoVFWDriverInfo* driver);
};

Listing Two
coclass oVFW
{
    [default] interface IoVFW;
    [default, source] dispinterface _oVFWEvents;
};


Listing Three
class ATL_NO_VTABLE CoVFW : 
  public CComObjectRootEx<CComSingleThreadModel>,
  public CComCoClass<CoVFW, &CLSID_oVFW>,
  public CComControl<CoVFW>,
  public CStockPropImpl<CoVFW, IoVFW, &IID_IoVFW, &LIBID_oVFW>,
  public IProvideClassInfo2Impl<&CLSID_oVFW, &DIID__oVFWEvents, &LIBID_oVFW>,
  public IPersistStreamInitImpl<CoVFW>,
  public IPersistStorageImpl<CoVFW>,
  public IQuickActivateImpl<CoVFW>,
  public IOleControlImpl<CoVFW>,
  public IOleObjectImpl<CoVFW>,
  public IOleInPlaceActiveObjectImpl<CoVFW>,
  public IViewObjectExImpl<CoVFW>,
  public IOleInPlaceObjectWindowlessImpl<CoVFW>,
  public IDataObjectImpl<CoVFW>,
  public ISupportErrorInfo,
  public IConnectionPointContainerImpl<CoVFW>,
  public CProxy_oVFWEvents<CoVFW>,
  public ISpecifyPropertyPagesImpl<CoVFW>
{

Listing Four
EXTERN_C const IID DIID__oVFWEvents= 
   { 0x54526101, 0xf0ca, 0x11d1, 
   { 0x96, 0x9f, 0x0, 0x20, 0x18, 
     0x63, 0x16, 0x32 } };

Listing Five
BEGIN_CONNECTION_POINT_MAP(CoVFW)
    CONNECTION_POINT_ENTRY(DIID__oVFWEvents)
END_CONNECTION_POINT_MAP()

Listing Six
pDriverInfo= new CComObject<CoVFWDriverInfo>;
dynamic_cast<IoVFWDriverInfo*>(pDriverInfo)->AddRef();

Listing Seven
dynamic_cast<IoVFWDriverInfo*>(pDriverInfo)->Release();

Listing Eight
return Error( 
_T("oVFWDriverInfo: bad driver information object"), 
IID_IoVFWDriverInfo, CUSTOM_CTL_SCODE(1009));

Listing Nine
Set Picture1.Picture = Clipboard.GetData(vbCFDIB)

Listing Ten
  ...RGS stuff here...
      ForceRemove {5A5FFDB1-F0A7-11D1-969F-002018631632} = s 'oVFW control'
     {
  ...additional RGS stuff here...
    ForceRemove 'Implemented Categories'
    {
         ForceRemove '{7DD95801-9882-11CF-9FA9-00AA006C42C4}'
         ForceRemove '{7DD95802-9882-11CF-9FA9-00AA006C42C4}'
        }
     }

Listing Eleven
<script language="VBScript">
<!--
Sub window_onload()
   vfw.ShowLiveVideo true
end sub
-->
</script>

<p><object id="vfw" name="vfw"
classid="clsid:5A5FFDB1-F0A7-11D1-969F-002018631632"
align="baseline" border="0" width="320" height="240" h="240"
w="320">Ofer LaOr - VFW</object> </p>


2


