You are viewing our Forum Archives. To view or take place in current topics click here.
~VB.NET Tutorials inc Auto-Clicker and Memory Adder
Posted:

~VB.NET Tutorials inc Auto-Clicker and Memory AdderPosted:

colinwCFC
  • V5 Launch
Status: Offline
Joined: Feb 12, 201014Year Member
Posts: 2,561
Reputation Power: 1072
Status: Offline
Joined: Feb 12, 201014Year Member
Posts: 2,561
Reputation Power: 1072
These tutorials are very basic and aimed at the beginners to Visual Basic, more experienced users of Visual Basic may still wish to use these tutorials, enjoy.


Get website's IP address




Open up Visual Studio 2010 and select new project.
Then chose a name for your project and chose "Windows Form Application".

[ Register or Signin to view external links. ]

Next resize the Form image to the size you want your program to be to be, then on the left hand side there should be a "Toolbox".

From here we create our User Interface, we need to add;

1 button
2 text-boxes
2 labels

Lay them out like this:

[ Register or Signin to view external links. ]

For the names:

top text-box: textsite
bottom text-box: textip
button and 2 labels: leave them as they are.

Captions:

Text-boxes: blank
Button: Get IP
Top label: website
bottom label: IP

Double click on the button and delete all of that coding, replace it with this code:

Imports System.Net

Public Class Form1

    Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
        Try
            If TextSite.Text.Contains("http://") Then
                Dim iphe As IPHostEntry = Dns.GetHostEntry(TextSite.Text.Replace("http://", String.Empty))
                TextIp.Text = iphe.AddressList(0).ToString()
            Else
                Dim iphe As IPHostEntry = Dns.GetHostEntry(TextSite.Text)
                TextIp.Text = iphe.AddressList(0).ToString()
            End If
        Catch ex As Exception
            MsgBox(ex)
        End Try
    End Sub
End Class


Now your code should look like this:

[ Register or Signin to view external links. ]

Next press this button [ Register or Signin to view external links. ] found at the top of the screen and this should appear:

[ Register or Signin to view external links. ]

If you did not get that then double check to make sure your code is the EXACT same as mine.

Once you have it like this then test out your program by typing in a web address, for this example I used google:

[ Register or Signin to view external links. ]

That is this tutorial over, in the next one I will show you how to crypt your personal information.


Encrypt Your Personal Informaion




Open up Visual Studio 2010 and select new project.
Then chose a name for your project and chose "Windows Form Application".

[ Register or Signin to view external links. ]

Next resize the Form image to the size you want your program to be to be, then on the left hand side there should be a "Toolbox".

From there create:

1 button
3 labels
3 textboxes

Leave all of the names as they were.

Make sure your layout is similar to this:

[ Register or Signin to view external links. ]

The textbox order is:

textbox1
textbox3
textbox2

Make the text on your items are the same as these:

[ Register or Signin to view external links. ]

Now for the code, double click on your button and delete all of the text that was there. Now copy all of this code onto your Form1.vb:

Imports System.Security.Cryptography
Imports System.Text

Public Class Form1
    Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
        Label2.Enabled = True
        Label3.Enabled = True
        TextBox2.Enabled = True
        TextBox3.Enabled = True

        TextBox2.Text = EncryptMe(TextBox1.Text)
        TextBox3.Text = DecryptMe(TextBox2.Text)
    End Sub

    Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
        Label2.Enabled = False
        Label3.Enabled = False
        TextBox2.Enabled = False
        TextBox3.Enabled = False
    End Sub

    Public Function EncryptMe(ByVal sData As String) As String
        Dim mSHA As New SHA1Managed
        Dim dString() As Byte = ASCIIEncoding.ASCII.GetBytes(sData)
        Dim cString As String = Convert.ToBase64String(dString)

        Convert.ToBase64String(mSHA.ComputeHash(Encoding.ASCII.GetBytes(sData)))
        EncryptMe = cString
    End Function

    Public Function DecryptMe(ByVal sData As String) As String
        Dim dData() As Byte = Convert.FromBase64String(sData)
        Dim dString As String = ASCIIEncoding.ASCII.GetString(dData)

        DecryptMe = dString
    End Function
End Class


Run your program by clicking on the green arrow at the top of the screen and type your word to be encrypted into the input-box, your final result should look like this:

[ Register or Signin to view external links. ]

Thats it for this tutorial, in the next one I will show you how to make an Auto-clicker.


Auto-Clicker




(Step 1) Create a new Windows Form.

(Step 2) Add two buttons (Start and Stop), and a Timer.

Make the layout like this:

[ Register or Signin to view external links. ]

(Step 3) double click on your form and delete all of the text. Paste the code below into your form1.vb:

Public Class Form1
    Public Const MOUSEEVENTF_LEFTDOWN = &H2
    Public Const MOUSEEVENTF_LEFTUP = &H4
    Private Const MOUSEEVENTF_RIGHTDOWN = &H8
    Private Const MOUSEEVENTF_RIGHTUP = &H10
    Declare Function apimouse_event Lib "user32.dll" Alias "mouse_event" (ByVal dwFlags As Int32, ByVal dX As Int32, ByVal dY As Int32, ByVal cButtons As Int32, ByVal dwExtraInfo As Int32) As Boolean
    Private Sub Timer1_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer1.Tick
  Call apimouse_event(MOUSEEVENTF_LEFTDOWN, 0, 0, 0, 0)
  Call apimouse_event(MOUSEEVENTF_LEFTUP, 0, 0, 0, 0)
    End Sub
    Private Sub Button1_Click_1(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
  Timer1.Start()
    End Sub
    Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
  Timer1.Stop()
    End Sub
End Class


Click the green arrow at the top of the screen and your program should look like this:

[ Register or Signin to view external links. ]

WARNING: Be careful with this as this is a very effective program.

Thats it for this tutorial, the next tutorial will be for a Case Changer


Case Changer




Open up Visual Studio 2010 and select new project.
Then chose a name for your project and chose "Windows Form Application".

[ Register or Signin to view external links. ]

Next resize the Form image to the size you want your program to be to be, then on the left hand side there should be a "Toolbox".

From here we create our User Interface, we need to add;

4 Buttons
2 Labels
2 Text-Boxes

Lay them out like this with the same text:

[ Register or Signin to view external links. ]

Set all of the objects except the start button's visibility to False.

Make sure the buttons are as follows for the names of them:

[ Register or Signin to view external links. ]

Double click on the first button and delete all of the text, now copy this code into the space:

Public Class Form1
    Dim word2 As String
    Dim word1 As String
    Dim character As String
    Dim code As String
    Dim newcode As Integer
    Dim noc As Integer
    Dim a As Integer
    Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
        word2 = ""
        word1 = InputBox("Key in word(s)")
        noc = Len(word1)

        wordbefore.Clear()
        wordafter.Clear()

        For a = 1 To noc
            character = Mid(word1, a, 1)
            code = Asc(character)
            If code > 64 And code < 91 Then
                newcode = code + 32
                character = Chr(newcode)
            End If
            word2 = word2 & character
        Next a
        wordafter.Text = word2
        wordbefore.Text = word1
    End Sub

    Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
        word1 = InputBox("Key in word(s)")
        noc = Len(word1)
        word2 = ""

        wordbefore.Clear()
        wordafter.Clear()

        For a = 1 To noc
            character = Mid(word1, a, 1)
            code = Asc(character)
            If code > 96 And code < 123 Then
                newcode = code - 32
                character = Chr(newcode)
            End If
            word2 = word2 & character
        Next a
        wordafter.Text = word2
        wordbefore.Text = word1
    End Sub

    Private Sub Button4_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button4.Click
        Me.Close()
    End Sub

    Private Sub Button3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button3.Click
        Button1.Visible = True
        Button2.Visible = True
        Button3.Visible = False
        Button4.Visible = True
        Label1.Visible = True
        Label2.Visible = True
        wordafter.Visible = True
        wordbefore.Visible = True
    End Sub
End Class


That is your Case Changer now completed.

To use this program click on the Start button to open up this page:

[ Register or Signin to view external links. ]

To change to lower case press "Upper Case To Lower Case" and follow the instructions and to change to upper case press "Lower Case To Upper Case" and follow the instructions.

Proof that this will work:

[ Register or Signin to view external links. ]
[ Register or Signin to view external links. ]
[ Register or Signin to view external links. ]
[ Register or Signin to view external links. ]

Thats it for this tutorial.


.exe Memory Pumper



Open up visual studio and create a new windows form.
Add:
2 Buttons
2 Text-Boxes
2 Labels
1 Openfiledialog

Set them out like this:
[ Register or Signin to view external links. ]

Source Code:

Imports System.IO

Public Class Form1

    Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
        OpenFileDialog1.DefaultExt = "exe"
        OpenFileDialog1.Filter = "exe files (*.exe)|*.exe"
        OpenFileDialog1.FilterIndex = 1
        If OpenFileDialog1.ShowDialog(Me) = DialogResult.OK Then
            TextBox1.Text = String.Empty
            TextBox1.Text = OpenFileDialog1.FileName
        End If
    End Sub

    Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
        If TextBox1.Text = "" Then
            MsgBox("Enter bytes to add")
        Else
            Dim file1 = File.OpenWrite(TextBox1.Text)
            Dim siza = file1.Seek(0, SeekOrigin.[End])
            Dim size = Convert.ToInt32(TextBox2.Text)
            Dim bite As Decimal = size * 1048576
            While siza < bite
                siza += 1
                file1.WriteByte(0)
            End While
            file1.Close()
            MessageBox.Show("Done !")
        End If
    End Sub
End Class


Basically thats it, simple file pumper.


CD Drive Open/Close




Open visual studio and creat a new "Windows Form Application".

For creating the GUI we need to have:

2 start buttons.

Button1: Open CD Drive
Button2: Close CD Drive

Really basic GUI, set the buttons beside each other like this:

[ Register or Signin to view external links. ]

Now for the code:

Double click button1 and then delete all of the text. Copy this text in to the blank space:

'colinwCFC
'29th September 2010
'The Tech Game
Public Class Form1
    Private Declare Function mciSendString Lib "winmm.dll" Alias "mciSendStringA" (ByVal lpstrCommand As String, ByVal lpstrReturnString As String, ByVal uReturnLength As Long, ByVal hwndCallback As Long) As Long
    'I made a variable of the type "Long" to receive the output of the API function and I made it public so that all subroutines will be able to recognize it.
    Public retValue As Long
    Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
        'In this line of code I entered parameters to the API function and then received the output which will be long value in the variable retValue
        retValue = mciSendString("Set CDAudio door open", 0, 0, 0)
    End Sub
    Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
        'the same as before but i changed the first parameter so that i can close the CD.
        retValue = mciSendString("Set CDAudio door Closed", 0, 0, 0)
    End Sub
End Class


The closing of the CD Drive will only work on a PC.

Thats it for this tutorial.




SkaterTG Edit - Added the programs you didn't have from my tutorial to yours, hope you don't mind too much

How to make your own version of Windows Media Player.



In this tutorial i am using Visual Studio 2010 to make this Media Player.

Once you have the program, open it up -> select a new project.

It should then come up with this:

[ Register or Signin to view external links. ]

Then chose a name for your project and chose "Windows Form Application".

Next resize the Form image to the size you want your windows media player to be, then on the left hand side there should be a "Toolbox".

Open it, go down to "Components" and right click on it, then go to Choose items.
It should look like this:

[ Register or Signin to view external links. ]

Now your gonna wanna change the tab to "COM Components" scroll down and find Windows Media Player, tick the box for it and hit OK. Like this:

[ Register or Signin to view external links. ]

Now on the bottom of the "Components" tab should be a Windows media button, drag and drop it onto the form and stretch it to fit the form how big you want it to be.

Next your going to want to add a openfiledialog, found underneath the "Dialog" box in the toolbox obviously then drag and drop it onto the form...
Here is where you should be able to find it.
[ Register or Signin to view external links. ]

Next your going to want to drag and drop a menu strip onto the form, it is found here on the toolbox:

[ Register or Signin to view external links. ]

Then click on the menustrip and at the top of the form there should be some boxes that look like this:

[ Register or Signin to view external links. ]

In the first box write File, then underneath that write Open then underneath open write Exit and on the right of File write in About in the box. These are your menus for your program. (Just make sure you leave enough room for this menu when resizing your media player)
So it should look like this:
[ Register or Signin to view external links. ]

Now you have to name your files. To do this you have to click on the file you are naming and on the properties of that file you have to find where it says name and change it. For this program we are only going to change the 1 name of the player itself, click on the actual player go to name and rename it Player1. It should look like this:

[ Register or Signin to view external links. ]

Next you need to change the Filter for the openfiledialog so when you hit the Open button after it is properly coded you can open any media file into your WMP. You need to write into the filter:
 (*.*)|*.*

e.g.
[ Register or Signin to view external links. ]

Okaayy, thats pretty much the UI done.

Time for the coding, its really simple and it is literally just 3 lines of adding codes.

First of all, click on FILE and then double click on the OPEN word.
This'll take you too the coding, it should be this to start off with without you editing anything:

Private Sub OpenToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles OpenToolStripMenuItem.Click

    End Sub


The code you have to insert if your using all the application names as i did:

OpenFileDialog1.ShowDialog()
        Player1.URL = OpenFileDialog1.FileName


So just add that code in-between "End Sub" and the other text and thats that done. Should look like this:

[ Register or Signin to view external links. ]

Now onto the EXIT button... simple enough, just double click on EXIT and in-between the text like before simply type in:

Me.Close()


And thats done.

Then hit the [ Register or Signin to view external links. ] green button on the left of the Debug and test it out .

To Fix the program in place so people can't make it bigger or maximise it click on the actual Form, look for "FormBorderStyle and on the menu for it change it from "Sizeable" to "Fixed 3D" -> [ Register or Signin to view external links. ] .
Then go to "MaximizeBox" and change it from True to False -> [ Register or Signin to view external links. ]

Now it shouldn't move How to create an "About box" will be in the next spoiler


Okayy so in this next spoiler i will be teaching you how to create an About box and how to link it to programs you have made and want to create an "About" for...


On whatever project you what the aboutbox on, you click on this:

[ Register or Signin to view external links. ]

Then go to "Windows Form" then click on About Box and then hit "ADD" at the bottom of the page after you have named it...

[ Register or Signin to view external links. ]

Then it'll come up with your UI for your AboutBox, change it around by clicking on each box and in properties find "Text" and just change the text, you do NOT have to change the name. And to change your picture click on the picture box and in properties go to "Image" which is under the heading of "Appearance" and upload a picture.

Next for the code part.

Double click on the whole form, and delete all this part which i have put lines around:

[ Register or Signin to view external links. ]

Deleting this part of the code makes it so whatever changes you make to the UI actually happens rather than reverting back to the default settings.

Once you have deleted that part, go back to your main WMD and on your form double click on "ABOUT" and in-between the private sub blah blah and End Sub type:

AboutBox1.Show()


Then hit run on the program and hit about and it should come up with your About box.
Note: it is not always called AboutBox1.show, its whatever you first called your aboutbox when chosing it in the options so if i called it skatertg the code would be skatertg.show() =]

You have now linked them, this can be used for any application.



Feel free to +rep or thank the topic if I helped you


Last edited by colinwCFC ; edited 6 times in total

The following 5 users thanked colinwCFC for this useful post:

-Influence (02-24-2011), TTG_LEDz (12-04-2010), Dean (12-04-2010), tomo23 (12-02-2010), PossibleDerp (12-02-2010)
#2. Posted:
Cozo
  • TTG Undisputed
Status: Offline
Joined: Apr 24, 201014Year Member
Posts: 5,102
Reputation Power: 405
Status: Offline
Joined: Apr 24, 201014Year Member
Posts: 5,102
Reputation Power: 405
Nice post bro.

i might try using vb.

i made a spam thingy in it lol
#3. Posted:
colinwCFC
  • 2 Million
Status: Offline
Joined: Feb 12, 201014Year Member
Posts: 2,561
Reputation Power: 1072
Status: Offline
Joined: Feb 12, 201014Year Member
Posts: 2,561
Reputation Power: 1072
iTz_CaZ wrote Nice post bro.

i might try using vb.

i made a spam thingy in it lol


Thanks, good luck if you decide to make any of these
#4. Posted:
PossibleDerp
  • Shoutbox Hero
Status: Offline
Joined: May 15, 201014Year Member
Posts: 2,189
Reputation Power: 325
Status: Offline
Joined: May 15, 201014Year Member
Posts: 2,189
Reputation Power: 325
Glad you have re-posted this Collin some good sources
here + Rep
#5. Posted:
ktwizzle13
  • 2 Million
Status: Offline
Joined: Mar 24, 201014Year Member
Posts: 5,407
Reputation Power: 289
Status: Offline
Joined: Mar 24, 201014Year Member
Posts: 5,407
Reputation Power: 289
this deserves a sticky nice job man
#6. Posted:
colinwCFC
  • V5 Launch
Status: Offline
Joined: Feb 12, 201014Year Member
Posts: 2,561
Reputation Power: 1072
Status: Offline
Joined: Feb 12, 201014Year Member
Posts: 2,561
Reputation Power: 1072
TTG_Ragnarock wrote this deserves a sticky nice job man


PartTimeDisciple wrote Glad you have re-posted this Colin some good sources
here + Rep


Thank you both for your support. I was hoping to add more tutorials but since skater added his I might not.
#7. Posted:
tomo23
  • Ladder Climber
Status: Offline
Joined: Jan 23, 201014Year Member
Posts: 392
Reputation Power: 16
Status: Offline
Joined: Jan 23, 201014Year Member
Posts: 392
Reputation Power: 16
Thank you , this should be a sticky well done
#8. Posted:
colinwCFC
  • Retired Staff
Status: Offline
Joined: Feb 12, 201014Year Member
Posts: 2,561
Reputation Power: 1072
Status: Offline
Joined: Feb 12, 201014Year Member
Posts: 2,561
Reputation Power: 1072
tomo23 wrote Thank you , this should be a sticky well done


Thank you, I put a lot of effort into these tutorials and I'm sure skatertg did to his aswell.
#9. Posted:
iTzMt
  • Ladder Climber
Status: Offline
Joined: Dec 01, 201013Year Member
Posts: 330
Reputation Power: 15
Status: Offline
Joined: Dec 01, 201013Year Member
Posts: 330
Reputation Power: 15
Brilliant post, Gunna use it l8r when im on ,main computer
#10. Posted:
Dean
  • 2000 Thanks
Status: Offline
Joined: Jun 15, 200915Year Member
Posts: 11,403
Reputation Power: 1161
Status: Offline
Joined: Jun 15, 200915Year Member
Posts: 11,403
Reputation Power: 1161
great job colin ma man

Easy to follow tutorials here ;O


Thanks

Should be sticky

Dean
Jump to:
You are viewing our Forum Archives. To view or take place in current topics click here.