There is no direct way of doing that. You will probably have to use the functions and events that the "Who"-interface uses. I have never used them myself, so I cannot give much help. There is some documentation here:
http://www.wowwiki.com/World_of_Warc...#Who_Functions
AFAIK, the who-functionality is asynchrone. That means, when you request information from the server, the result is not returned immediately. Instead an event will be fired later when the result is ready for retrieval using other functions. There is also a time limit on how often the client can make a who-request. So you are not guaranteed to always get a result back. Lastly, doing a who-request may open up the Who-dialog or print results to the chat window. It is possible that you could hook into Blizzard's code for the who-dialog to prevent that, though.
In summary, it's not easy and you are never sure to get a result. So don't make you program too dependent on it.
