Blog Stats
  • Posts - 6
  • Articles - 0
  • Comments - 8
  • Trackbacks - 17

 

Programmatically changing Yahoo Messenger's status

Alright, I'd been looking for this stuff for a while. I couldn't find any useful resources on the internet so thought of giving it a try to find out how its actually done. Thought people like me would be interested in knowing.

Seems like we need to setup a custom message in registry and notify yahoo of this change we've made. We need to set the “HKCU\Software\Yahoo\Pager\Profiles\[current user]\Custom Msgs\5” to our new status message and send WM_COMMAND message with wParam set to 392 (write me a mail if you need to know how I figured this out) to the yahoo messenger's main window(see the code snippet below to see how current user is retrieved).

Here is how you can do it in C#(I guess you can figure out the PInvoke declarations)

private void ChangeYahooStatus (string newStatus)

{

// Get the current signed in user

//

RegistryKey keyYahooPager = Registry.CurrentUser.OpenSubKey ("Software\\Yahoo\\Pager");

string sUserName = (string)keyYahooPager.GetValue ("Yahoo! User ID");

keyYahooPager.Close();

System.Diagnostics.Debug.WriteLine ("The currently logged in user is " + sUserName);

 

// Now open the current user's profile and set the current status message, pass true to

// OpenSubKey to request write access

RegistryKey keyYahooCustomMessages = Registry.CurrentUser.OpenSubKey ("Software\\Yahoo\\Pager\\profiles\\"

+ sUserName + "\\Custom Msgs", true);

 

// 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", newStatus);

keyYahooCustomMessages.Close ();

 

// We are done setting the value in the registry. We now need to notify y! of this change

//

 

// Find the yahoo messenger window and sent 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);

}

 


Feedback

# re: Programmatically changing Yahoo Messenger's status

Gravatar Hi,
I dont know how to operate C or C+ or for that matter even C++.
So i'll be glad if u or anyone of you can take some time out from ur busy and programming schedules and guide me how to bring the Online Status in motion in Yahoo; step-by-step; without using C or C+ or C++ in layman's terms.
Please; i seriously wanna know how to do this amazing stuff.
Please respect my feelings.
U can even mail the steps to me at
twistofate4u@yahoo.com
Thanx in Advance.
May God Bless You 10/29/2005 10:28 PM | Jack

# re: Programmatically changing Yahoo Messenger's status

Gravatar in wich namespaces can I find "FINDWONDOW" and "POSTMESSAGE", cause I get an error on these
THX 11/27/2005 6:24 PM | zoli

# re: Programmatically changing Yahoo Messenger's status

Gravatar Here is what these declarations look like:

[DllImport("USER32.DLL", EntryPoint="FindWindowA", CallingConvention=CallingConvention.StdCall)]
private static extern IntPtr FindWindow(string sClassName, string sWindowName);

[DllImport("USER32.DLL", EntryPoint="PostMessageA", CallingConvention=CallingConvention.StdCall)]
private static extern bool PostMessage(IntPtr hWnd, uint iMsg, long wParam, long lParam); 11/28/2005 7:09 PM | Uday

# re: Programmatically changing Yahoo Messenger's status

Gravatar Hi I am using your method to make a count-down timer in the messanger. It works fine for a while but after a few minutes my messanger window goes crazy and I can't evevn close it, I have to end the process from the task manager.
Do you have an idea what might cause that?

PS: others still se my status updating every second, but the busy icon sometimes is on sometimes in not.
THX 11/30/2005 12:57 PM | zoli

# re: Programmatically changing Yahoo Messenger's status

Gravatar Hello.
I want to use your idea but i really don't know how exactly. Pls help me.

mail me: daniliuc_c@yahoo.com 1/20/2006 12:30 PM | cristi

# re: Programmatically changing Yahoo Messenger's status

Gravatar in 7.5, at least the beta version, it doesn't work anymore because they've removed the current user id from the registry, or at least they've hidden it somewhere else. 2/7/2006 8:14 PM | booster

# re: Programmatically changing Yahoo Messenger's status

Gravatar want to know how did you get "WM_COMMAND message with wParam set to 392"

bryandel3@yahoo.com 3/12/2006 6:53 PM | Bryan

# re: Programmatically changing Yahoo Messenger's status

Gravatar I am using Yahoo! Messenger 7.0 version (with voice). I tried out this code. But there is no Registry key "profiles" i found under "Yahoo\\pager\\". So it doesn't work at my side. 4/20/2006 9:24 AM | Nanddeep Nachan

# I have implemented your code both in C# and C++/CLI

Gravatar Please try it from my site www.mathenphy.com/promo.htm

From a computer running it, the program seems having no problem. However, from remote computers, they will see my banner get changed only several minutes; after several hours my banner starts to change again; this process works periodically.
What is the cause of this strange behavior ?

thanks

guntank 4/29/2006 2:25 AM | Guntank

# re: Programmatically changing Yahoo Messenger's status

Gravatar I want to use your idea but i really don't know how exactly. Pls help me. 8/15/2006 3:43 PM | david

# re: Programmatically changing Yahoo Messenger's status

Gravatar i have y! messeger 8 , it seems that is a trouble changing status...
pls tell me 11/3/2006 11:57 PM | mike

# re: Programmatically changing Yahoo Messenger's status

Gravatar they changed the way how they keep the status messages... hhhhmm... they removed it from the registry... and probably, placed it somewhere in a file...

intersting... 11/8/2006 9:52 AM | rakas

# re: Programmatically changing Yahoo Messenger's status

Gravatar Thanks for your excellent code!!!
Could you tell me how did you get the two parameters:
// 0x111: WM_COMMAND
// 0x188: Code 392

And when i use your code to change Yahoo Status with 1s interval, after about 5 minutes, i can't change it once more. Can you solve that problem.

Thanks in advanced.
11/10/2006 9:33 AM | ManhVT

# re: Programmatically changing Yahoo Messenger's status

Gravatar Ah, I figured out how YM 8.x is now storing the custom messages. In addition to the plain text value (with key names "1", "2", etc.), they're storing the text in a binary registry key as ASCII-encoded hex values (with key names "1_bin", "2_bin", etc.). Here's a C# example of how to update custom message 1:

RegistryKey key = Microsoft.Win32.Registry.CurrentUser;
key = key.OpenSubKey("Software\\Yahoo\\Pager\\profiles\\" + yahooUserId + "\\Custom Msgs", true);
key.SetValue("1", (string)status);
byte[] statusBin = (new ASCIIEncoding()).GetBytes(status);
key.SetValue("1_bin", (byte[])statusBin );
key.Close();
3/30/2007 2:01 AM | Catatonic

# re: Programmatically changing Yahoo Messenger's status

Gravatar Great! It's working! Thanks a lot! 4/4/2007 1:27 PM | Mircea

# re: Programmatically changing Yahoo Messenger's status

Gravatar Before 8.x, all one had to do was change the message text in the registry and, if needed, set the flag to 0 (available) or 1 (unavailable).

It appears that 8.x does not refresh the custom messages unless "it" writes them now through their really dumb window/interface. That functionality though has never really worked well in Any of the versions.

Another gripe I have with 8.x is the annoying and unecessary pop-up about communicating with other chat programs. 8.x also seems to hang my machine when it attempts to check for updates. The flag to Not auto-check is gone now.

I'll be uninstalling 8.x and going back to 7.x. The latest version isn't worth the hassle. 8/8/2007 6:07 PM | chief squirrel

# re: Programmatically changing Yahoo Messenger's status

Gravatar How to add an icon to the status? I'm talking about displaying fake status icon for example webcam, idle, headphone... 10/7/2007 4:03 PM | Kasjansky

# re: Programmatically changing Yahoo Messenger's status

Gravatar Hello,
Thanks for the code. Is there any way to programmatically send 'buzz' in yahoo messanger? 12/12/2007 1:21 PM | Giorgi

# re: Programmatically changing Yahoo Messenger's status

Gravatar thanks for sharing, but i need help with these.. XD
pls and thank yooh.
email me: cindeehrella@yahoo.com
10/4/2008 10:06 AM | cirose

# re: Programmatically changing Yahoo Messenger's status

Gravatar That's a very usefull information, however, I'm not sure it it's really working. 10/26/2008 5:42 PM | danut

# re: Programmatically changing Yahoo Messenger's status

Gravatar Hi,

Is it possible to send a message to yahoo messenger using c# codes? 10/27/2008 8:39 AM | Matt Aghnianejad

# re: Programmatically changing Yahoo Messenger's status

Gravatar Hello,
I have found your blog while searching for a way to change Yahoo Messenger status. I have tried it on Yahhoo Messenger 8 and it worked like a charm.
Can you please tell me the how to change the status of Yahoo Messenger 9?

Thank you 7/17/2009 8:46 AM | Florin

# Still alive ?

Gravatar Hi m8,

I don't have experience in C, C# or C++ ... but I was wandering if you are still doing some "updates" to you coding.

Waiting for you answer,
Marius 9/23/2009 2:45 AM | Marius

Post a comment





 

 

 

Copyright © Uday K Verma