Andrea Bertolotto
MyMind.InvokeMember("Dump", BindingFlags.Default | BindingFlags.InvokeMethod, null, o, new object[] {"0xD3F3C+00"});
Skip Navigation LinksHome > Articles > What I'm workin' on rss  

Skip Navigation Links.
   
What I'm workin' on Skype Addon 1.0.0.0

3/20/2006
Download  Download (96 KB)

Background

With MSN Messenger add-in in mind, the one that show what you're listening in Windows Media Player, I decided to code a similar utility to show, in my Skype "mood", what I'm working on (using Visual Studio 2003). I know this seems a bit twisted: using Visual Studio 2005 to code something to get data from Visual Studio 2003. Anyway this was a very quick tool to get the idea working; when I'll be spending most of my time developing in VS2005 probably a sequel to this will follow .

Implementation

First of all, code to connect and interact with Skype is from Gabriel Szabo.
We can find complete implementation of classes to use Skype from C# in this article: CodeProject article by Gabriel Szabo.
Secondly, we have to know how to set our "mood" in Skype. This is easily done consulting Skype public API reference at: Skype API Reference.
What we are interested in is this command:
#abc SET PROFILE MOOD_TEXT Put your current mood here
Next, we have to get data from Visual Studio current window. This is done by the "VisualStudioWindowUtils" class. This one basically uses Windows API to get VS title bar and retrieve project and file data from there, parsing strings. These are relevant API:
[System.Runtime.InteropServices.DllImport("user32.dll",
CharSet = System.Runtime.InteropServices.CharSet.Auto)]
private static extern IntPtr FindWindow(string lpClassName,
string lpWindowName);

[System.Runtime.InteropServices.DllImport("user32.dll",
CharSet = System.Runtime.InteropServices.CharSet.Auto)]
private static extern int GetWindowText(IntPtr hwnd,
string lpString, int cch);
I also added a textbox in main window, so we can have a filter on VS window title, allowing to pick only desired project if working with many projects at the same time.

Because we can start as many utilities as we want, application also implement the Mutex trick to be Single-Instance.

At last, I would like to always be on the last line of RichTextBox, to show last logged event, so I added this code to force scrolling (I've not found another way of getting this without using PInvoke):
[System.Runtime.InteropServices.DllImport("user32.dll",
CharSet = System.Runtime.InteropServices.CharSet.Auto)]
private static extern Int32 SendMessage(IntPtr hwnd, Int32 wMsg,
Int32 wParam, Int32 lParam);

private void ScrollText(RichTextBox Destination)
{
    int SB_BOTTOM = 7;
    int WM_VSCROLL = 0x0115;

    SendMessage(Destination.Handle, WM_VSCROLL, SB_BOTTOM, 0);
}
   
My status Get Skype and call me for free.


















 
Copyright © 2004-7 - Andrea Bertolotto - Site Version: 2.3.0.0 - 2/22/2010