Archive for the 'MessengerAPI' Tag

VB Net - MSN Nudger Full Project

Imports System.Runtime.InteropServicesImports MessengerAPIPublic Class Form1 <DllImport(“kernel32.dll”)> Public Shared Function WriteProcessMemory(ByVal hProcess As IntPtr, ByVal lpBaseAddress As IntPtr, ByVal lpBuffer As Byte(), ByVal nSize As UIntPtr, <Out()> ByRef lpNumberOfBytesWritten As IntPtr) As Boolean End Function ‘@The fucnction to allow us to disable the timer Public Declare Function SendMessage Lib “user32.dll” Alias “SendMessageA” (ByVal hwnd As Int32, ByVal wMsg As Int32, ByVal wParam As Int32, ByVal lParam As IntPtr) As Int32 <DllImport(“user32.dll”, EntryPoint:=“FindWindow”)> Private Shared Function FindWindowByCaption(ByVal zero As IntPtr, ByVal lpWindowName As String) As IntPtr End Function Public Const CMD_NUDGE = &H2B1 Public Const WM_COMMAND As Long = &H111 Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click Dim Processes() As System.Diagnostics.Process ”get processes Processes = System.Diagnostics.Process.GetProcessesByName(“msnmsgr”) ”find messenger If Processes.Length = 0 Then ”check that the process was found MessageBox.Show(“Windows Live Messenger process was not found”, “Error:”, MessageBoxButtons.OK, MessageBoxIcon.Error) Exit Sub End If Dim msnpath As String = Processes(0).MainModule.FileName Dim msnversion As String = System.Diagnostics.FileVersionInfo.GetVersionInfo(msnpath).FileVersion ”get the version of user If Not msnversion = “8.1.0178.00″ Then ”my version is 8.1…. If MessageBox.Show(“The version of Windows Live Messenger you are running is not the same that this program was intended, you are running:” & vbNewLine & msnversion & vbNewLine & “The intended version is 8.1.0178.00, you can try and enable nudging if you wish but it may crash WLM” & vbNewLine & “Do you want to enable?”, “Error: Wrong version, continue?”, MessageBoxButtons.YesNo, MessageBoxIcon.Warning) = Windows.Forms.DialogResult.No Then Exit Sub End If End If Dim nops As Byte() = New Byte(6 - 1) {&H90, &H90, &H90, &H90, &H90, &H90} ”create our data to write ”&H90 = NOP in ASM, which stands for No OPeration WriteProcessMemory(Processes(0).Handle, New IntPtr(&H61F239), nops, New UIntPtr(CType(nops.Length, UInt32)), New IntPtr(0)) ”Write the data to the proocess,—————–the address——————-size————————-length MessageBox.Show(“Windows Live Messenger was sucessfully modified” & vbNewLine & “6 Bytes written at address 0061F239″, “Done:”, MessageBoxButtons.OK, MessageBoxIcon.Exclamation) End Sub Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click ”checks that the fields are filled in correctly If TextBox1.Text = “” Then MessageBox.Show(“Please enter a valid contact email address”, “Error:”, MessageBoxButtons.OK, MessageBoxIcon.Error) Exit Sub ElseIf InStr(TextBox1.Text, “@”) = 0 Then MessageBox.Show(“Please enter a valid contact email address”, “Error:”, MessageBoxButtons.OK, MessageBoxIcon.Error) Exit Sub ElseIf NumericUpDown1.Value = 0 Then MessageBox.Show(“Please enter a number of times to send the nudge”, “Error:”, MessageBoxButtons.OK, MessageBoxIcon.Error) Exit Sub End If Dim oMessenger As Messenger oMessenger = New Messenger Dim msncontact As IMessengerContact Dim msncontacts As IMessengerContacts ”gets the msn contacts msncontacts = oMessenger.MyContacts For Each msncontact In msncontacts ”loop through them If msncontact.SigninName = TextBox1.Text Then ”till it finds a matching contact oMessenger.InstantMessage(msncontact) ”open window Dim times As Integer = 0 Dim wnd As Integer = 0 wnd = FindWindowByCaption(0, msncontact.FriendlyName & ” - Conversation”) ”finds the window If wnd = 0 Then Dim Processes() As System.Diagnostics.Process ”if it dosnt find the window (contact may have weird symbols) Processes = System.Diagnostics.Process.GetProcessesByName(“msnmsgr”) If Processes.Length = 0 Then ”check that the process was found MessageBox.Show(“Windows Live Messenger process was not found”, “Error:”, MessageBoxButtons.OK, MessageBoxIcon.Error) Exit Sub End If wnd = Processes(0).MainWindowHandle ’sets the handle to the window End If Do times += 1 SendMessage(wnd, WM_COMMAND, CMD_NUDGE, 0) ‘’sends a nudge Loop Until times = NumericUpDown1.Value ”x amount of times MessageBox.Show(“Done”, “MSN Nudge Spam”, MessageBoxButtons.OK, MessageBoxIcon.Exclamation) Exit Sub End If Next MessageBox.Show(“Error, contact matching that email was not found”, “Error:”, MessageBoxButtons.OK, MessageBoxIcon.Error) End SubEnd Class

Example form:

nudger.jpg

Download @

http://cid-50c4db1f234d8c02.skydrive.live.com/self.aspx/Public/Windows%20Live%20Messenger%208.1%20Nudger.exe
http://cid-50c4db1f234d8c02.skydrive.live.com/self.aspx/Public/Interop.MessengerAPI.dll

VB Net - Change MSN Status (Status Spam)

Public Shared Sub ChangeStatus(ByVal count As Integer)
Dim oMessenger As MessengerAPI.Messenger
oMessenger = New MessengerAPI.Messenger
Dim times As Integer = 0
Do
times += 1
oMessenger.MyStatus = MISTATUS.MISTATUS_ONLINE
System.Threading.Thread.Sleep(100)
oMessenger.MyStatus = MISTATUS.MISTATUS_INVISIBLE
System.Threading.Thread.Sleep(100)
Loop Until times = count
End Sub

Usage:  ChangeStatus(20)

VB Net - MSN Block Spam

Public Shared Sub BlockSpam(ByVal count As Integer, ByVal contact As String)
Dim done As Boolean = False
Dim oMessenger As MessengerAPI.Messenger
oMessenger = New MessengerAPI.Messenger
Dim msncontact As IMessengerContact
Dim msncontacts As IMessengerContacts
msncontacts = oMessenger.MyContacts
For Each msncontact In msncontacts
If msncontact.SigninName = contact Then
Dim times As Integer = 0
done = True
Do
times += 1
msncontact.Blocked = True
System.Threading.Thread.Sleep(400)
msncontact.Blocked = False
System.Threading.Thread.Sleep(400)
Loop Until times = count
MessageBox.Show(”Done”, “MSN Block Spam”, MessageBoxButtons.OK, MessageBoxIcon.Exclamation)
Exit Sub
End If
Next
MessageBox.Show(”Error, contact matching that email was not found”, “Error:”, MessageBoxButtons.OK, MessageBoxIcon.Error)
End Sub

Usage: BlockSpam(10, “spiderman@hotmail.com”)

VB Net - List MSN Contacts

Public Shared Sub Getcontacts(ByVal ListViewAdd As ListView)
ListViewAdd.View = View.Details
ListViewAdd.FullRowSelect = True
ListViewAdd.GridLines = True
ListViewAdd.Columns.Clear()
ListViewAdd.Items.Clear()
ListViewAdd.Columns.Add(”Friendly Name”, 1, HorizontalAlignment.Left)
ListViewAdd.Columns.Add(”Status”, 1, HorizontalAlignment.Left)
ListViewAdd.Columns.Add(”Email Address”, 1, HorizontalAlignment.Left)
ListViewAdd.Columns.Add(”Something”, 1, HorizontalAlignment.Left)
ListViewAdd.Columns.Item(0).Width = ListViewAdd.Width - 160 - 5
ListViewAdd.Columns.Item(1).Width = 60
Dim oMessenger As MessengerAPI.Messenger
oMessenger = New MessengerAPI.Messenger
Dim msncontact As IMessengerContact
Dim msncontacts As IMessengerContacts
msncontacts = oMessenger.MyContacts

Dim Awaylist As New ListViewGroup
Dim BRBlist As New ListViewGroup
Dim Busylist As New ListViewGroup
Dim Idlelist As New ListViewGroup
Dim Invisilist As New ListViewGroup
Dim Offlist As New ListViewGroup
Dim Phonelist As New ListViewGroup
Dim Lunchlist As New ListViewGroup
Dim Unklist As New ListViewGroup
For Each msncontact In msncontacts
Dim item1 As New ListViewItem(msncontact.FriendlyName)
Dim Status As String = “Offline”
If msncontact.Status = MISTATUS.MISTATUS_AWAY Then
Status = “Away”
ElseIf msncontact.Status = MISTATUS.MISTATUS_BE_RIGHT_BACK Then
Status = “BRB”
ElseIf msncontact.Status = MISTATUS.MISTATUS_BUSY Then
Status = “Busy”
ElseIf msncontact.Status = MISTATUS.MISTATUS_IDLE Then
Status = “Idle”
ElseIf msncontact.Status = MISTATUS.MISTATUS_INVISIBLE Then
Status = “Invisible”
ElseIf msncontact.Status = MISTATUS.MISTATUS_OFFLINE Then
Status = “Offline”
ElseIf msncontact.Status = MISTATUS.MISTATUS_ON_THE_PHONE Then
Status = “On Phone”
ElseIf msncontact.Status = MISTATUS.MISTATUS_ONLINE Then
Status = “Online”
ElseIf msncontact.Status = MISTATUS.MISTATUS_OUT_TO_LUNCH Then
Status = “Lunch”
ElseIf msncontact.Status = MISTATUS.MISTATUS_UNKNOWN Then
Status = “Unknown”
End If
item1.SubItems.Add(Status)
item1.SubItems.Add(msncontact.SigninName)
If Status = “Away” Then
Awaylist.Items.Add(item1)
item1.SubItems(0).BackColor = Color.Red
ElseIf Status = “BRB” Then
BRBlist.Items.Add(item1)
item1.SubItems(0).BackColor = Color.LightGray
ElseIf Status = “Busy” Then
Busylist.Items.Add(item1)
item1.SubItems(0).BackColor = Color.Orange
ElseIf Status = “Idle” Then
Idlelist.Items.Add(item1)
item1.SubItems(0).BackColor = Color.Red
ElseIf Status = “Invisible” Then
Invisilist.Items.Add(item1)
item1.SubItems(0).BackColor = Color.Peru
ElseIf Status = “Offline” Then
Offlist.Items.Add(item1)
item1.SubItems(0).BackColor = Color.Peru
ElseIf Status = “On Phone” Then
Phonelist.Items.Add(item1)
item1.SubItems(0).BackColor = Color.Blue
item1.SubItems(0).ForeColor = Color.Pink
ElseIf Status = “Online” Then
ListViewAdd.Items.Add(item1)
item1.SubItems(0).BackColor = Color.Black
item1.SubItems(0).ForeColor = Color.Orange
ElseIf Status = “Lunch” Then
item1.SubItems(0).BackColor = Color.Blue
item1.SubItems(0).ForeColor = Color.Pink
Lunchlist.Items.Add(item1)
ElseIf Status = “Unknown” Then
Unklist.Items.Add(item1)
item1.SubItems(0).BackColor = Color.Black
item1.SubItems(0).ForeColor = Color.Red
End If

Next
ListViewAdd.Items.AddRange(BRBlist.Items)
ListViewAdd.Items.AddRange(Busylist.Items)
ListViewAdd.Items.AddRange(Awaylist.Items)
ListViewAdd.Items.AddRange(Idlelist.Items)
ListViewAdd.Items.AddRange(Phonelist.Items)
ListViewAdd.Items.AddRange(Lunchlist.Items)
ListViewAdd.Items.AddRange(Invisilist.Items)
ListViewAdd.Items.AddRange(Unklist.Items)
ListViewAdd.Items.AddRange(Offlist.Items)
ListViewAdd.Columns.Item(2).AutoResize(ColumnHeaderAutoResizeStyle.ColumnContent)
End Sub

Usage:

Getcontacts(ListView1)
ListView1.Columns(0).Width = ListView1.Width - ListView1.Columns(1).Width - ListView1.Columns(2).Width - 19
ListView1.Height = Me.Height - GroupBox2.Height - 50

VB Net - Change MSN Display Picture

Imports MessengerAPI

Public Shared Sub SetDisplayPic(ByVal path As String)
Const MCONTACTPROP_USERTILE_PATH As Long = 2
Dim oMessenger As MessengerAPI.Messenger
oMessenger = New MessengerAPI.Messenger
oMessenger.MyProperty(MCONTACTPROP_USERTILE_PATH) = path
End Sub

Usage:

Dim fbo As New OpenFileDialog
fbo.Filter = “All Images (*.bmp;*.gif;*.jpg;*.jpeg;*.png)|*.bmp;*.gif;*.jpg;*.jpeg;*.png”
fbo.ShowDialog()
Try
Functions.SetDisplayPic(fbo.FileName)
MessageBox.Show(”Done”, “Change Display Picture”, MessageBoxButtons.OK, MessageBoxIcon.Exclamation)
Catch ex As Exception
End Try

Edit: updated the file dialog with image filter