Click here to Skip to main content
Click here to Skip to main content
Go to top

Online TV Toolbar Button Play TV Shows & Videos in Internet Explorer

, 23 Aug 2011
Rate this:
Please Sign up or sign in to vote.
TV Toolbar Button Plays Online TV Shows in Internet Explorer Tabs
Screenshot - ievideo1.gif


I wrote the first online TV Toolbar in 1997 that plays TV Shows in Internet Explorer. There are a lot of cool projects I have seen posted on this site, and one, in particular, caught my interest, namely, "Adding a drop-down menu to an IE Toolbar button" by Igor Tolmachev.
I modified and enhanced the code for adding a button with a dropdown in Internet Explorer and added code to play video inside of Internet Explorer Tabs using Microsoft's DirectShow by getting the handle to the IE tab.

The new version of IEVideo in Visual Studio 2008 is called TV Button and can be found at IE Video in VS2008.

Requires DirectX to Compile

To compile the sample code, you must download and install DirectX and "Extras." The "Extras" download from Microsoft contains the DirectShow samples and you must compile the "BaseClasses" in DirectShow. Just put this project in the "Samples\C++" directory in the DirectShow Extras download to make it easier to set the correct pathway for "dshow.h" header file.

Getting the Handle to a Tab in Internet Explorer 7

The key to making this work was getting the handle to the tab in I.E. 7 and we can get the handle to the tab window in unmanaged C++ as follows:

BOOL bFound = FALSE;
IServiceProvider* pServiceProvider = NULL;
if (SUCCEEDED(m_pWebBrowser2->QueryInterface(IID_IServiceProvider, 
   IOleWindow* pWindow = NULL;
   if (SUCCEEDED(pServiceProvider->QueryService(SID_SShellBrowser, 
      IID_IOleWindow, (void**)&pWindow))) {
      HWND hwndBrowser = NULL;
      if (SUCCEEDED(pWindow->GetWindow(&hwndBrowser))) {
         // hwndBrowser is the handle of TabWindowClass         bFound = TRUE;
if (bFound)
   //Play Video Here...

In either managed C# or unmanaged C++, once we have the handle to the tabbed IE browser window, we can play video.

Play Video in Parts of Web Pages by Getting a
Handle to an <APPLET> tag or Any Similar Tag

Many different types of HTML objects like "<APPLET>" tags have handles. This means that you can play video inside of parts of a web page by simply getting the handle to the HTML object like an <APPLET> tag. For example, you can add a web page with a tag like:

<APPLET class="videoapplet"> height="240" width="320"></APPLET> 

Then just get the handle to this <APPLET> tag to play video inside of it using this button.
You can also create a non-rectangular region for the applet as well.

To do this, you need to get a handle to that object in the web page and the worst way to get a handle to any HTML object is to use the DOM and COM interfaces which are very slow and which fail occasionally. The fastest and most reliable way to get the handle to any HTML element such as an <applet> is to use EnumChildWindows to get the handles to all windows by their class attributes contained within a specified region of the WebBrowser control.

The COM interfaces do not give you a handle to the window holding the HTML object so even if you invoke any COM interface you still have to use an API function like EnumChildWindows to get the handles to the window, thus COM is a complete waste of time and gives you nothing. So I went directly to reading the window classes for a given point within a region of an HTML page.

If you have any questions about the toolbar, please feel free to contact me at:

Bill SerGio, The Infomercial King


This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)


About the Author

William SerGio
Software Developer (Senior)
United States United States
I love coding and develop desktop apps (C++, C#, Java), websites, and mobile apps (iPhone, Android, Blackberry, iPad, PhoneGap/Cordova).
I am launching a new national TV series that features the best mobile apps. Show me your apps!
I have written software for Microsoft,, Quicken (Intuit), Mellon Bank, U.S. Army, U.S. Navy, Franklin Templeton, Pepsi, Universal Studios, Ryder Systems, AVID, Media 100, etc.
Bill SerGio

Comments and Discussions

GeneralMy vote of 5 PinmemberBill SerGio, The Infomercial King22-Sep-11 22:37 
GeneralRe: My vote of 5 PinmemberKochise23-May-12 0:35 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.

| Advertise | Privacy | Mobile
Web01 | 2.8.140905.1 | Last Updated 23 Aug 2011
Article Copyright 2011 by William SerGio
Everything else Copyright © CodeProject, 1999-2014
Terms of Service
Layout: fixed | fluid