Programming

Change Your Yahoo Messenger Status – The "24" Way

Hello all,

This is based on a little program I wrote a year or so ago. I cannot take credit for the idea, I found it on a forum. I was looking for a way to change the status displayed by Y! Messenger by an external  program. It turns out it can be achieved by a combination of registry tampering and Windows application messages.

I wrote the program in C# as it was the fastest way to get something working within a day or less(while working on other things as well).

So here’s the deal. In your Windows registry under HKEY_CURRENT_USER there is a key SoftwareYahooPager where Y! Messenger saves your last used status messages. They are saved on a per profile basis. If you save your ID on the computer you are running Y! Messenger then you can get the current logged in user from “Yahoo! User ID” key; otherwise the user ID will have to be given manually.

// Get the current signed in user
RegistryKey keyYahooPager =
    Registry.CurrentUser.OpenSubKey("Software\Yahoo\Pager");
string sUserName =
   (string)keyYahooPager.GetValue("Yahoo! User ID");
keyYahooPager.Close();

if (sUserName == null) // Username is not stored on machine
{
    sUserName = "my_username";
}

Now that you have your user name(profile in Y! Messenger speak) you can modify one of your saved status messages, in this case the values 5_W and 5_binwarning: the key to modify may vary depending on your program version. The 5_W value contains the text version of the status and the 5_bin the binary version(byte by byte – ASCII encoded).

// Set the 5th message, seems like yahoo messenger
// has the functionality to move the newly set
// message up as the first one.
keyYahooCustomMessages.SetValue("5_W", newStatus);
keyYahooCustomMessages.SetValue("5_bin",
   System.Text.ASCIIEncoding.ASCII.GetBytes(newStatus),
   RegistryValueKind.Binary);
keyYahooCustomMessages.Close();

There is only one more step to do after you’ve set the registry values.You need to send a Windows message to the Y! Mess application which simulates you selecting from the saved status list the one we just set in the registry. You do this by importing two Win32 functions:

[DllImport("user32.dll")]
static extern IntPtr FindWindow(string lpClassName, string lpWindowName);

[DllImport("User32.Dll")]
public static extern IntPtr PostMessage(IntPtr hWnd, int msg,
   int wParam, int lParam);

Then using them to send the message you want:

// We are done setting the value in the registry.
// We now need to notify y! of this change
// Find the yahoo messenger window and send it the notification
// 0x111: WM_COMMAND
// 0x188: Code 392
IntPtr hWndY = FindWindow("YahooBuddyMain", null);
System.Diagnostics.Debug.WriteLine("Find window got: " + hWndY.ToString());
PostMessage(hWndY, 0x111, 0x188, 0);

That’s all the coding you need to change your Y! Messenger status.I was and still am a bit of a fan of the TV show “24” so I made mine display the current time (hh:mm) and a message like the ones spoken by Jack Bauer at the beginning of each episode(you know, “The following takes place between…”). I had some fun with this status changer. I made it read from a text files lines I wanted to be displayed every minute, in a cycle. Point is, you can do anything you want with it. I set mine to change the status every minute. Be warned however that changing your status message too fast and too often will result in a temporary ban from the yahoo servers disabling your ability to change your status. For me, 1 minute was a safe interval. Anything less than 30 seconds, I think, is dangerous.

For the lazy, I am attaching my version of the complete C# program.

StatusChanger

5 thoughts on “Change Your Yahoo Messenger Status – The "24" Way”

Leave a Reply to Cristian Sandu Cancel reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.