• This is a read only backup of the old Emudevs forum. If you want to have anything removed, please message me on Discord: KittyKaev

(release) / (share) VB Launcher Code

Nalo

Enthusiast
Good day Emudevians Today id like to release my collection of VB wow Launcher Code

Hope u guys enjoy





Code:
============================================================================================================================
============================================================================================================================
============================================================================================================================
----------------------------------------------------------------------------------------------------------------------------
CLOSE BUTTON ---------------------------------------------------------------------------------------------------------------
----------------------------------------------------------------------------------------------------------------------------
												----------------------------
me.close()											----------------------------
												----------------------------
----------------------------------------------------------------------------------------------------------------------------
Minimize Button-------------------------------------------------------------------------------------------------------------
----------------------------------------------------------------------------------------------------------------------------
 												----------------------------
Me.WindowState = FormWindowState.Minimized							----------------------------
												----------------------------
----------------------------------------------------------------------------------------------------------------------------
WINDOW MOVE AROUND Place before Script starts ---------------------------------------------------------------------------------------------------------
----------------------------------------------------------------------------------------------------------------------------

#Region "ClientAreaMove Handling"
    Private Const WM_NCHITTEST As Integer = &H84
    Private Const HTCLIENT As Integer = &H1
    Private Const HTCAPTION As Integer = &H2

    Protected Overrides Sub WndProc(ByRef m As System.Windows.Forms.Message)
        Select Case m.Msg
            Case WM_NCHITTEST
                MyBase.WndProc(m)
                If m.Result = HTCLIENT Then
                    m.Result = HTCAPTION
                End If
            Case Else
                'Make sure you pass unhandled messages back to the default message handler.
                MyBase.WndProc(m)
        End Select
    End Sub
#End Region

---------------------------------------------------------------------------------------------
WOW START BUTTON (lunch application button ) ----------------------------------------------------------------------------
---------------------------------------------------------------------------------------------
Dim AppPath = (CurDir() & "\Wow.exe")
        Shell(AppPath, vbMinimizedFocus)
        Me.Close()

---------------------------------------------------------------------------------------------
Change Realmlist (change somthing in a .Txt file) ----------------------------------------------------------------------------
---------------------------------------------------------------------------------------------
Dim Write As New System.IO.StreamWriter(CurDir() & "\Data\EnUS\Realmlist.wtf")
        Write.Write("[B]set realmlist  Here[/B]")
        Write.Close()
        

---------------------------------------------------------------------------------------------
UPDATE BUTTON (CHECK ONLY)-------------------------------------------------------------------
---------------------------------------------------------------------------------------------

Dim request As System.Net.HttpWebRequest = System.Net.HttpWebRequest.Create("Dropbox URL") 
        Dim response As System.Net.HttpWebResponse = request.GetResponse()						    
        Dim sr As System.IO.StreamReader = New System.IO.StreamReader(response.GetResponseStream())			    
        Dim newestversion As String = sr.ReadToEnd()									    
        Dim currentversion As String = Application.ProductVersion
        If newestversion.Contains(currentversion) Then
            MessageBox.Show("your Launcher is up to date (^^,)")
        Else
            MessageBox.Show("Update is avalible")
        End If

---------------------------------------------------------------------------------------------
Open extra form e.g WEB browsers/boxes -----------------------------------------------------
---------------------------------------------------------------------------------------------

([B]NAME of the extra form[/B]).show()

---------------------------------------------------------------------------------------------
DOWNLOAD AND REPLACE LAUNCHER (UPDATE) ------------------------------------------------------
---------------------------------------------------------------------------------------------

((use with Check for update section))		e.g c:\downloadfile.exe
My.Computer.Network.DownloadFile("[B]url[/B]", "[B]File location + filename[/B]")
        Process.Start("File.location + filename")

----------------------------------------------------------------------------------------------
actual download (can be used to open normal websites aswell) ---------------------------------
----------------------------------------------------------------------------------------------

System.Diagnostics.Process.Start("[B]URL HERE[/B]")

----------------------------------------------------------------------------------------------
LIVE NEWS STREAM -----------------------------------------------------------------------------
----------------------------------------------------------------------------------------------

Imports System.Net ( at the very top)
					(on the FORM it self)

(above the the private sub)
Dim web As New Net.WebClient
Dim news As String = "PUBLIC link"
  

    Private Sub Form1_Load_1(sender As System.Object, e As System.EventArgs) Handles MyBase.Load
        Try
            Me.RichTextBox1.Text = web.DownloadString(news)
        Catch ex As Exception

        End Try

..................................................................................................
REMOVE CACHE (deletes a folder in a dir) -------------------------------------------------------------------------------------
--------------------------------------------------------------------------------------------------

IO.Directory.Delete([B]CurDir() & "\Cache[/B]", True)

=============================================================================================
Changes Realmlist (looks for the folder 2 diff choices)
=============================================================================================

    'If it finds the install path go to realmlist and change it to our one
           If Directory.Exists(InstallPath & "\Data\enUS") Then
                Dim realmlist As StreamWriter = New StreamWriter(InstallPath & "\Data\enUS\realmlist.wtf", False)
                'Change realmlist
               realmlist.WriteLine("[B]set realmlist here[/B]")
                realmlist.Close()
                'Start WoW.exe
               Process.Start(InstallPath & "\wow.exe")
                'If they have GB version of WoW
           ElseIf Directory.Exists(InstallPath & "\Data\enGB") Then
                Dim realmlist As StreamWriter = New StreamWriter(InstallPath & "\Data\enGB\realmlist.wtf", False)
                'Change realmlist
               realmlist.WriteLine("[B]set realmlist here")[/B]
                realmlist.Close()
                'Start WoW.exe
               Process.Start(InstallPath & "\wow.exe")
                'End the Launcher
	end if
=============================================================================================
=============================================================================================
---------------LIVE NEWS + SERVER STAT-------------------------------------------------------


---------------------------------------------------------------------------------------------
 Dim Apache As New TcpClient
Dim World As New TcpClient

(under forum 1)
---------------------------------------------------------------------------------------------
===================================================================================
looks if the server is online (displayes the online logo)
if not online displayes offline logo
===================================================================================
Try
        REM Tells the launcher to try to do the following
            Apache.Connect("[B]Your Servers IP Address[/B]", (80))
        REM Tells the launcher to connect to your servers IP address on port 80
        Catch ex As Exception
        REM Tells the launcher what to do if a connection is not made
            Label1.Visible = True
            REM Tells the launcher to make label1 visible
        End Try
        REM Tells the launcher to stop trying the above
        Try
        REM Tell the launcher to try the following
            World.Connect("[B]Your Servers IP Address[/B]", (8085))
            REM Tells the launcher to connect to your server IP address on port 8085
        Catch ex As Exception
        REM Tells the launcher what to do if a connection is not made
            Label3.Text = "OFFLINE"
            REM Tells the launcher to set label3's text to "OFFLINE'
            Label3.ForeColor = Color.Red
            REM Tells the launcher to set label3's forecolor to red
        End Try
        REM Tells the launcher to stop trying the above

        If Apache.Connected Then
        REM Checks if Apache is connected
            WebBrowser1.Visible = True
            REM Makes the web browser visible if Apache is connected
            WebBrowser1.Navigate("[B]http://Your Website Here/launcher/news.html[/B]")
            REM Navigates the web browser to http://Your Website Here/launcher/news.html
            Label1.Hide()
            REM Hides label1 from view
            Apache.Close()
            REM Closes the socket Apache was using *ALWAYS CLOSE YOUR SOCKETS
        End If
        REM Ends the above IF statement

        If World.Connected Then
        REM Checks if World is connected
            Label3.Text = "ONLINE"
            REM Changes lebel3's text to "ONLINE" if World is connected
            Label3.ForeColor = Color.Green
            REM Changes label3's fore color to green if World is connected
            World.Close()
            REM Closes the socket World was using *ALWAYS CLOSE YOUR SOCKETS
        End If
        Rem Ends the above if statement



----------------------------------------------------------------------------------------------------------------------------------
How to select a install path for the custom patches 
----------------------------------------------------------------------------------------------------------------------------------

 My.Computer.Network.DownloadFile("[B]DOWNLOAD URL HERE[/B]", FolderBrowserDialog1.showdialog())

----------------------------------------------------------------------------------------------------------------------------------

If u have any problems dont hesitate to PM me or POst a comment on this post :)

this has helped me soo much in the past hope it will help someone els now :somuchwin:
 

ToxicDev

Banned
I use to make launchers in vb. Haven't done it in a long time but at this time I am trying to learn c# and learn how to make the crazy designs for the forms with xaml. But i do a lot of stuff through out my day so ill get around to it eventually :D Anyway thanks for the release/share im sure it will help some people.
 
Top