i wrote this little Win32 Console program to show you how. it is designed for Yahoo Messenger, since i don't use MSN Messenger. it disables the Search button.
when you open this program it searches for Yahoo Messenger. if its not open or the title of the window is different than "Yahoo Messenger". you get an error. if it is open it finds the Search button. and disables it.
Code:
#include<iostream.h>
#include<windows.h>
BOOL CALLBACK EnumProc(HWND hwnd, LPARAM lParam)
{
char wndtitle[255];
GetWindowText(hwnd, wndtitle, 254);
if(!strcmp(wndtitle, "&Search"))
{
EnableWindow(hwnd, FALSE);
}
return TRUE;
}
int main()
{
HWND hYahoo;
hYahoo = FindWindow(0, "Yahoo! Messenger");
if(hYahoo == NULL)
{
cout<<"Yahoo! Messenger is not open or has a different title";
return 0;
}
EnumChildWindows(hYahoo, EnumProc, 0);
return 0;
}
i don't have much time. so repost if you dont understand.