Writing the ActiveX control =========================== Start a new MFC ActiveX C++ project. Use all the default settings except in Control Settings, change the control to be based on STATIC. Add a dialog resource... Get rid of the existing widgets on the dialog. Set the following properties... Broder = Thin caption = "" Control = true Style = Child title bar = false Leave the ID as IDD_DIALOG1 Create a new MFC class... call it CControlDialog Set the base class to CDialog Set the Dialog ID to IDD_DIALOG1 Go to class view... Right click the ctrl class... Add variable. Set the following Access = proteced Variable type = CControlDialog Variable name = mDialog Click finish Go to class view. Click on the ctrl class Show properties. Click on messages icon In the WM_CREATE message section add the text "OnCreate" A new OnCreate function has been produced. At minimum add the following code after the autogenerated code... mDialog.Create(IDD_DIALOG1, this); mDialog.ShowWindow(TRUE); Adding a play button ==================== Go back to resource view.. open the dialog. Add a button. Change the caption to play. Double click the button... a new method should be generated. Check the message map to ensure the following has been added. ON_BN_CLICKED(IDC_BUTTON1, OnBnClickedButton1) If it hasn't add it manually, ensuring you use the correct IDC and function name. Grabbing a browser instance... ============================ In ControlDialog.h Manually add the following public function prototype void setBrowser(IWebBrowser2* inBrowser); Manually add the following protected variable. IWebBrowser2* mBrowser; In the constructor... initialise to NULL. Manually implement a function for setBrowser in ControlDialog.cpp, which assingsg inBrowser to mBrowser. Add the following code into the ctrl classes OnCreate method to grab the browser interface and send it to the dialog. IServiceProvider* locISP = NULL; IWebBrowser2* locBrowser = NULL; HRESULT locHR = GetClientSite()->QueryInterface(IID_IServiceProvider, (void **)&locISP); if (locHR == S_OK) { locHR = locISP->QueryService(IID_IWebBrowserApp, IID_IWebBrowser2, (void **)&locBrowser); if (locHR == S_OK) { mDialog.setBrowser(locBrowser); } locISP->Release(); } Put the following code in the destructor for the dialog class. if (mBrowser != NULL) { mBrowser->Release(); } Repeat procedure for adding play button to add pause and stop button. Add a generic class class called DSPlayer... steal all the internal code from DSPlay (the .NET player library for DNPlay) Change all the managed code parts back to unmanaged equivalents. Create an unmanaged interface for media event notifications. Code to embed windows in the control... (This is in DSPLayer now) //CHANGES HERE FOR EMBEDDED WINDOW IVideoWindow* locVW = NULL; locHR = locGraphBuilder->QueryInterface(IID_IVideoWindow, (void **)&locVW); if (locHR == S_OK) { locVW->put_MessageDrain((OAHWND)inWindow); locVW->put_Owner((OAHWND)inWindow); locVW->SetWindowPosition(inLeft, inTop, inWidth, inHeight); locVW->Release(); } // Read this for registering an activeX control as the player for an extension in IE http://msdn.microsoft.com/workshop/components/activex/registration.asp