Hello, I am an Engineering Manager at Facebook with 13+ years in Ad Technology, Natural Language Processing and Data mining. (Learn More)
by Pravin Paratey

FindWindow Illustration

The following code illustrates the use of FindWindow API. This program blanks out the ad in Yahoo Messenger buddy window. It has been tested on Yahoo Messenger 7.5 and 8.0.

// This code illustrates hiding the Ad in the Buddy window of Yahoo Messenger
// Copyright (c) 2006, Pravin Paratey (http://pravin.paratey.com)

#include <windows.h>

int WINAPI WinMain (HINSTANCE hInst, HINSTANCE hPrev, LPSTR lpszArgs, int nCmdWnd)
{
    HWND hYahooWnd = FindWindowEx(NULL, NULL, "YahooBuddyMain", NULL);
    if(hYahooWnd) { // Yahoo Messenger is running
        HWND hAtlWnd = FindWindowEx(hYahooWnd, NULL, "ATL:00821BC0", NULL);
        if(hAtlWnd) { // Found the window
            HWND hShellWnd = FindWindowEx(hAtlWnd, NULL, "Shell Embedding", NULL);
            if(hShellWnd) {
                HWND hDocObjWnd = FindWindowEx(hShellWnd, NULL, "Shell DocObject View", NULL);
                if(hDocObjWnd) { // This is the window we must hide
                    ShowWindow(hDocObjWnd, SW_HIDE);
                }
            }
        }
    }
    else {
        MessageBox(NULL, "No instances of Yahoo Messenger found", "Error", MB_OK);
    }
    return 0;
}

Download

You can download the source code or the binary.

Usage

Pretty straight forward. When yahoo messenger is running, double click the exe. The ads window will disappear :)