Introduction
This application gives the ability of writing floating text messages to the Personal Message of the MSN Messenger.
The application has speed, direction, and icon options. The user can select the speed of float as a value of milliseconds. Moreover, the user can select the direction of the movement, Left to Right or Right to Left. There are three icon options: Office, Games, and Music. When the Music icon option is selected, the text became as a textlink.
The application must be open during the making of the floating text message. When the application is minimized, it is shown as a trayicon. It will not be seen on the taskbar.
MSN Object Declarations
[DllImport("user32", EntryPoint="SendMessageA")]
private static extern int SendMessage(int Hwnd, int wMsg, int wParam, int lParam);
[DllImport("user32", EntryPoint="FindWindowExA")]
private static extern int FindWindowEx(int hWnd1, int hWnd2, string lpsz1, string lpsz2);
private const short WM_COPYDATA = 74;
public struct COPYDATASTRUCT
{
public int dwData;
public int cbData;
public int lpData;
}
public COPYDATASTRUCT data;
Function that Makes Interop to MSN Messenger
public int VarPtr(object e)
{
GCHandle GC = GCHandle.Alloc(e, GCHandleType.Pinned);
int gc = GC.AddrOfPinnedObject().ToInt32();
GC.Free();
return gc;
}
private void SendMSNMessage(bool enable, string category, string message)
{
string buffer = "\\0" + category + "\\0" + (enable ? "1" : "0") +
"\\0{0}\\0" + message + "\\0\\0\\0\\0\0";
int handle = 0;
data.dwData = 0x0547;
data.lpData = VarPtr(buffer);
data.cbData = buffer.Length * 2;
handle = FindWindowEx(0, handle, "MsnMsgrUIManager", null);
if (handle > 0)
SendMessage(handle, WM_COPYDATA, 0, VarPtr(data));
}
History
- 31st August, 2005: Initial post