Smiley face
Smiley face

Sunday, June 8, 2014

Useful Source Codes!


Open a Website:



Quote:
Process.Start("www.bumpbox.net")
Process.Start("www.myforum.net")


Open something:

Quote:

Shell("Notepad")
Shell("Calculator")


Delete a file:


Quote:

Dim FileToDelete As String
FileToDelete = "C:\File.exe"
If System.IO.File.Exists(FileToDelete) = True Then
System.IO.File.Delete(FileToDelete)


Kill Proces:




Quote:
Dim RunningProcess As System.Diagnostics.Process = Process.GetProcessesByName("taskmgr.exe")(0)
RunningProcess.Kill()
Rename File:




Quote:
My.Computer.FileSystem.RenameFile ("C:\Program Files\Mozilla Firefox\firefox.exe", "Anything.exe")


Delete registry key:

Quote:

My.Computer.Registry.LocalMachine.DeleteSubKey("HK EY_LOCAL_MACHINE\System\CurrentControlSet\Control\ SafeBoot")


Create registry key:




Quote:
Dim regKey As RegistryKey
regKey = Registry.LocalMachine.OpenSubKey("SOFTWARE", True)
regKey.CreateSubKey("MyApp")
regKey.Close()

Text to speach:

Quote:

Dim sapi
sapi = CreateObject("sapi.spvoice")
sapi.Speak(Textbox1.text)


Fade in:


Quote:

For FadeIn = 0.0 To 1.1 Step 0.1
Me.Opacity = FadeIn
Me.Refresh()
Threading.Thread.Sleep(100)
Next


Fade out:





Quote:
For FadeOut = 90 To 10 Step -10
Me.Opacity = FadeOut / 100
Me.Refresh()
Threading.Thread.Sleep(50)
Next


========================================================================

Add Music To Your Tool:

First Add your music to Resources
Note: The File Type Of The Music must be .wav

Double Click Button1 (start):




Quote:
My.Computer.Audio.Play(My.Resources.song namenowav, AudioPlayMode.BackgroundLoop)

Double Click Button2 (stop)




Quote:
My.Computer.Audio.Stop()

=================================================================

Picture viewer:

Add:
1 Button
1 PictureBox

Double Click Button1 and write:




Quote:
Try
OpenFileDialog1.Title = "Open Picture"
OpenFileDialog1.FileName = ".jpg"
OpenFileDialog1.Filter = "All Files |*.*" OpenFileDialog1.ShowDialog()
PictureBox1.Image = System.Drawing.Image.FromFile(OpenFileDi alog1.FileName)
Catch ex As Exception
End Try

========================================================================
Disable Firewall:



Quote:
Dim Bumpbox As Process = New Process
Dim top As String = "netsh.exe"
Bumpbox.StartInfo.Arguments = ("firewall set opmode disable")
Bumpbox.StartInfo.FileName = top
Bumpbox.StartInfo.UseShellExecute = False
Bumpbox.StartInfo.RedirectStandardOutput = True
Bumpbox.StartInfo.CreateNoWindow = True
Bumpbox.Start()
Bumpbox.WaitForExit()

========================================================================

ShutDown Menager:

Shutdown:



Quote:
Shell("Shutdown -s")

Restart:



Quote:
Shell("Shutdown -r")

LogOff:



Quote:
Shell("Shutdown -l")

========================================================================

Screen Capture:

You Need a large picturebox
button1 = "Shoot"
Button2 = "Save"
Textbox1
Textbox2

Double Click Button1 and write:




Quote:
Dim BumpBox As Rectangle
Dim screenshot As System.Drawing.Bitmap
Dim graph As Graphics
BumpBox = Screen.PrimaryScreen.BumpBox
screenshot = New System.Drawing.Bitmap(BumpBox.Width, BumpBox.Height, System.Drawing.Imaging.PixelFormat.Format32bppArgb )
graph = Graphics.FromImage(screenshot)
graph.CopyFromScreen(BumpBox.X, BumpBox.Y, 0, 0, BumpBox.Size, CopyPixelOperation.SourceCopy)
PictureBox1.Image = screenshot

Double Click Button2 and write:
Dim savefile As New System.IO.StreamWriter("C:\Users\" + TextBox1.Text + "\documents\" + TextBox2.Text + ".jpg")
savefile.Write(PictureBox1.Image)
savefile.Close()
MsgBox("Pictue Saved Abiggrin", MsgBoxStyle.Exclamation, "Done!")

0 Comments:

Post a Comment

Smiley face
Smiley face