[Guide] Visual Basic 2008 - How To Make A Custom Launcher -
05-20-2008
Custom Launcher
-by Caroe
Design :
1) Make a Textbox, And a Button (Button Should Be Called "Set Realmlist"
2) Make 2 More buttons, they should be called "Retail [EU]" and "Retail [USA]"
3) Make 2 More Buttons, called "Start WoW" and "Delete Cache"
4) Make a button, Called "Close"
5) set the Textbox and button "Set Realmlist" at eachother's site
6) You can also add "Save Settings" and "Load Settings" If u want. (U dont have to)
Coding :
1) Click on "Retail [EU]" and write in this code :
Code:
Dim installpath As String = String.Empty
installpath = My.Computer.Registry.GetValue("HKEY_LOCAL_MACHINESOFTWAREblizzard entertainmentworld of warcraft", "installpath", Nothing)
Dim fs As New FileStream(installpath & "realmlist.wtf", FileMode.Create, FileAccess.Write)
Dim s As New StreamWriter(fs)
s.WriteLine("set realmlist eu.logon.worldofwarcraft.com")
s.WriteLine("set patchlist eu.version.worldofwarcraft.com")
s.Close()
If MsgBox("Realmlist was set succesfully") Then
Else
MsgBox("error in setting realmlist")
End If
Notest that the red is the Realmlist, so if u wanna make a button to ur own server, add a button called "Your Server Name" and add same code, but change the realmlist.
2) On the "Retail [USA]" Use the same code, but change the realmlist :
Code:
Dim installpath As String = String.Empty
installpath = My.Computer.Registry.GetValue("HKEY_LOCAL_MACHINESOFTWAREblizzard entertainmentworld of warcraft", "installpath", Nothing)
Dim fs As New FileStream(installpath & "realmlist.wtf", FileMode.Create, FileAccess.Write)
Dim s As New StreamWriter(fs)
s.WriteLine("set realmlist Us.Logon.Worldofwarcraft.Com")
s.WriteLine("set patchlist Us.Version.Worldofwarcraft.Com(")
s.Close()
If MsgBox("Realmlist was set succesfully") Then
Else
MsgBox("error in setting realmlist")
End If
3) On the "Close" button use this Code :
Code:
Form1.Close()
4) on the "Start WoW" Button use this code :
Code:
Dim ss As String = startgame("HKEY_LOCAL_MACHINESOFTWAREblizzard entertainmentworld of warcraft", "installpath", "WoW.exe")
If ss <> String.Empty Then
My.Settings.wow = ss
My.Settings.Save()
End If
5) On "Delete Cache" use this:
Code:
Dim installpath As String = String.Empty
installpath = My.Computer.Registry.GetValue("HKEY_LOCAL_MACHINESOFTWAREblizzard entertainmentworld of warcraft", "installpath", Nothing)
If Directory.Exists(installpath & "/cache") Then
Directory.Delete(installpath & "/cache", True)
MsgBox("Cache deleted successfully")
Else
MsgBox("There is no cache")
End If
6) Lets take a break, Shall we ? so long, so good
7) Now to the "Set Realmlist" Button lets make the code, its the one that makes the "Custom" in Launcher. this is the code :
Code:
Dim installpath As String = String.Empty
installpath = My.Computer.Registry.GetValue("HKEY_LOCAL_MACHINESOFTWAREblizzard entertainmentworld of warcraft", "installpath", Nothing)
Dim fs As New FileStream(installpath & "realmlist.wtf", FileMode.Create, FileAccess.Write)
Dim s As New StreamWriter(fs)
s.WriteLine("set realmlist " + TextBox1.Text)
s.Close()
If MsgBox("Realmlist was set succesfully") Then
Else
MsgBox("error in setting realmlist") '
End If
its the exact same code as the others, but ! look at the red. i wrote "Set Realmlist " like in the other ones. but then i make a space after it, and said "+ Textbox1.Text" that does so it will change it to "Set Realmlist (And Whatever The Textbox Says)" that would be an example "Set Realmlist (Textbox = Caroe.Caroe) then it would be "Set Realmlist Caroe.Caroe"
8) and if u wanted the "Save Settings" and "Load Settings" buttons, here it comes,
9) "Save Settings" code :
Code:
My.Computer.FileSystem.WriteAllText("C:Saved Settings.txt", TextBox1.Text, False)
MsgBox("Your Settings Was Saved In C:Saved Settings.txt")
The Red Text makes it saving wherever the red text is, so in my example it saves in C:\ as "Saved Settings.txt" so it would be "C:\Saved Settings.txt".
10) now the "Load Settings" button, go to the code and say :
Code:
Dim OFD As New OpenFileDialog
OFD.Filter = ".txt | *.txt*"
If (OFD.ShowDialog(Me) = Windows.Forms.DialogResult.OK) Then
Dim O As New System.IO.StreamReader(OFD.FileName)
TextBox1.Text = O.ReadToEnd
O.Close()
End If
This one is a bit longer, and makes u able to open all .txt files (Text Documents) if u change the red to another file, u will be able to open that, but cannot be used in the launcher.
If u want to test mine, Here it is : [Only registered and activated users can see links. ]
Nominated [Only registered and activated users can see links. ] [Only registered and activated users can see links. ] so now im contributer will girls sleep with me?
Not to mention the settings should really be saved in the WoW folder not just C:\, I'd hate it if I had programs doing this all the time cluttering it up.
Emiloz ? i dont leech, since i didnt got the sourcecode from u.
me and a friend found it out. well i remember i asked u for code to make realmlist changer Custom and not Un-Custom, but u didnt tell me.. then i just realised it was actually easy to just add " + textbox1.text" so no, i dont leech
The first part of the code was leeched and some of the other parts from Kolikok
Visual Basic .NET Coder Will code programs for money/gamecard. Contact me on msn for more information! You have one more chance to do right and its tonight.
yeah in order to not get that Startgame error just put this in your code
Code:
Private Function startgame(ByVal RegPath As String, ByVal RegValue As String, ByVal ExeFile As String) As String
Dim retval
Dim installpath As String = String.Empty
installpath = My.Computer.Registry.GetValue(RegPath, RegValue, Nothing)
If Directory.Exists(installpath) Then
ChDir(installpath)
retval = Shell(ExeFile, 1)
Else
With OpenFileDialog1
.InitialDirectory = GetFolderPath(Environment.SpecialFolder.ProgramFiles)
If .ShowDialog() = Windows.Forms.DialogResult.OK Then
Process.Start(.FileName)
Return .FileName
End If
End With
End If
Return String.Empty
End Function
Site n00b.. (A leecher if I've been here for more than a month and can't earn 5 rep)
Rep Power: 1
Reputation: 2
Posts: 6
Join Date: May 2008
06-28-2008
I get countless errors when i am using the code. Certain codes they build ok but when i try to use the buttons i get errors. and some codes i cannot get to work wondering if i could get some help.