Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Public Class Form1
- Private Declare Function GetForegroundWindow Lib "user32" Alias "GetForegroundWindow" () As IntPtr
- Private Declare Auto Function GetWindowText Lib "user32" (ByVal hWnd As System.IntPtr, ByVal lpString As System.Text.StringBuilder, ByVal cch As Integer) As Integer
- Private makel As String
- Private Function GetCaption() As String
- Dim Caption As New System.Text.StringBuilder(256)
- Dim hWnd As IntPtr = GetForegroundWindow()
- GetWindowText(hWnd, Caption, Caption.Capacity)
- Return Caption.ToString()
- End Function
- Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
- End Sub
- Private Sub Timer1_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer1.Tick
- Dim CapTxt As String = GetCaption()
- If makel <> CapTxt Then
- makel = CapTxt
- If CapTxt.Contains("Facebook") = True Then
- My.Computer.Keyboard.SendKeys("Message " + vbLf + "Link", True)
- My.Computer.Keyboard.SendKeys("{ENTER}", True)
- End If
- End If
- End Sub
- Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
- Timer1.Enabled = True
- End Sub
- Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
- Timer1.Enabled = False
- End Sub
- End Class
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement