Thread: UI Installer
View Single Post
  #55  
Unread 03-22-2005, 04:15 PM
taco-man's Avatar
taco-man taco-man is offline
EQ2MAP Updater Author
This person is a EQ2Map developer.
Interface Author - Click to view interfaces
 
Join Date: Nov 2004
Server: Antonia Bayle
Posts: 1,349
Default

yea that would be simple to do all you would need would be something like
Code:
Imports System.IO

Public Class formname
    Public EQ2dir As String

    Private Sub CheckEQ2Path()
    If Microsoft.Win32.Registry.LocalMachine.OpenSubKey("Software\Microsoft\Windows\CurrentVersion\App Paths\EverQuest2.exe", False) Is Nothing Then
                'open file browser dialog and have the user select thier EQ2 directory
                GetEQ2Path()
            Else
                'get the registry entry to the eq directory and set it equal to the EQ2dir variable
                Dim RegEQ2dir As Microsoft.Win32.RegistryKey = Microsoft.Win32.Registry.LocalMachine.OpenSubKey("Software\Microsoft\Windows\CurrentVersion\App Paths\EverQuest2.exe", False)
                Dim PossibleEQ2dir As String = RegEQ2dir.GetValue("Path").ToString
                'dlgEQ2Path is a simple dialog which asks if the path is correct and has a yes and no dialog button.
                Dim dlg As New dlgEQ2Path

                ' Show the dialog and determine if they confirmed it was or not
                Select Case dlg.ShowDialog
                    Case DialogResult.Yes
                        'MessageBox.Show(PossibleEQ2dir)
                        MainEQ2dir = PossibleEQ2dir
                    Case DialogResult.No
                        GetEQ2Path()
                End Select
                dlg.Dispose()
            End If

    If IO.Directory.Exists(EQ2Path & "\TestServer\UI\") = True Then
                'the user uses a test server ui
    End if
    End Sub

    Public Sub GetEQ2Path()
        Dim EQ2locate As New OpenFileDialog
        EQ2locate.Filter = "EverQuest2.exe|EverQuest2.exe"
        EQ2locate.Title = "Select Your EverQuest2.exe file"
        EQ2locate.CheckFileExists = True
        EQ2locate.CheckPathExists = True
        EQ2locate.InitialDirectory = "C:\Program Files\Sony\EverQuest II"
        Select Case EQ2locate.ShowDialog()
            Case DialogResult.OK
                EQ2dir = IO.Path.GetDirectoryName(EQ2locate.FileName)
            Case DialogResult.Cancel
                MessageBox.Show("EverQuest2.exe was not selected, program will now close.")
                Application.Exit()
        End Select
        EQ2locate.Dispose()
    End Sub
I tried to include the relevant code however i could have missed something.
i didnt bother including the dialog box form i made to ask yes or no, however you could even just use a default yes/no dialog box.
__________________
EQ2MAP Updater Download
EQ2MAP Website
How to Install a custom interface
Reply With Quote