Jul 31 2006
Jul 31 2006
FindWindow Illustration
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 // This code illustrates hiding the Ad in the Buddy window of Yahoo Messenger 2 // 3 // Copyright (c) 2006, Pravin Paratey 4 // pravinp[at]gmail[dot]com (http://dustyant.com) 5 6 #include <windows.h> 7 8 int WINAPI WinMain (HINSTANCE hInst, HINSTANCE hPrev, LPSTR lpszArgs, int nCmdWnd) 9 { 10 HWND hYahooWnd = FindWindowEx(NULL, NULL, "YahooBuddyMain", NULL); 11 12 if(hYahooWnd) // Yahoo Messenger is running 13 { 14 HWND hAtlWnd = FindWindowEx(hYahooWnd, NULL, "ATL:00821BC0", NULL); 15 16 if(hAtlWnd) // Found the window 17 { 18 HWND hShellWnd = FindWindowEx(hAtlWnd, NULL, "Shell Embedding", NULL); 19 if(hShellWnd) 20 { 21 HWND hDocObjWnd = FindWindowEx(hShellWnd, NULL, "Shell DocObject View", NULL); 22 if(hDocObjWnd) // This is the window we must hide 23 { 24 ShowWindow(hDocObjWnd, SW_HIDE); 25 } 26 } 27 } 28 } 29 else 30 { 31 MessageBox(NULL, "No instances of Yahoo Messenger found", "Error", MB_OK); 32 } 33 return 0; 34 }
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 :)