rss

Self Picture

Natural Language Processing, Information Extraction and Search consultant.

 learn more   get in touch 

Logo - I Build Search
Jul 31
2006

FindWindow Illustration digg

Synopsis

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.

Code

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
// This code illustrates hiding the Ad in the Buddy window of Yahoo Messenger
//
// Copyright (c) 2006, Pravin Paratey
// pravinp[at]gmail[dot]com (http://dustyant.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 :)

3 Responses (rss) (trackback)

Leave a Reply

XHTML: You can use these tags: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong> <pre lang="" line="" escaped="">

This page and its contents are copyright © 2010, Pravin Paratey.