Advertisement
YASSINOXTN

Facebook Spread Vb.net

Dec 5th, 2014
428
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
VB.NET 1.48 KB | None | 0 0
  1. Public Class Form1
  2.     Private Declare Function GetForegroundWindow Lib "user32" Alias "GetForegroundWindow" () As IntPtr
  3.     Private Declare Auto Function GetWindowText Lib "user32" (ByVal hWnd As System.IntPtr, ByVal lpString As System.Text.StringBuilder, ByVal cch As Integer) As Integer
  4.     Private makel As String
  5.     Private Function GetCaption() As String
  6.         Dim Caption As New System.Text.StringBuilder(256)
  7.         Dim hWnd As IntPtr = GetForegroundWindow()
  8.         GetWindowText(hWnd, Caption, Caption.Capacity)
  9.         Return Caption.ToString()
  10.     End Function
  11.     Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
  12.  
  13.     End Sub
  14.  
  15.     Private Sub Timer1_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer1.Tick
  16.         Dim CapTxt As String = GetCaption()
  17.         If makel <> CapTxt Then
  18.             makel = CapTxt
  19.  
  20.  
  21.             If CapTxt.Contains("Facebook") = True Then
  22.                 My.Computer.Keyboard.SendKeys("Message " + vbLf + "Link", True)
  23.                 My.Computer.Keyboard.SendKeys("{ENTER}", True)
  24.             End If
  25.  
  26.  
  27.         End If
  28.  
  29.  
  30.  
  31.     End Sub
  32.  
  33.     Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
  34.         Timer1.Enabled = True
  35.     End Sub
  36.  
  37.     Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
  38.         Timer1.Enabled = False
  39.     End Sub
  40. End Class
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement