|
-
Dec 31st, 2007, 04:09 AM
#1
Thread Starter
Member
[2008] Help updating some things
Well, thanks to you guys i got my first program up and running, but i want to make a few changes... First of all... I want the program to load previously saved options... so When you save the 4 checkboxes and re-open the program... the most recent ones are still marked... Second.. Not all people have there .ini file always in the C:\Program Files\Silkroad\ So if there is a way to change that so people can select there silkroad directory that would be awesome as well. and i think thats it for now... anyway, heres the code.
Code:
Public Class Form1
Private Declare Function WritePrivateProfileString Lib "kernel32" Alias "WritePrivateProfileStringA" (ByVal lpApplicationname As String, ByVal lpKeyName As String, ByVal lsString As String, ByVal lplFilename As String) As Integer
Sub SaveINISetting(ByVal Filename As String, ByVal Key As String, ByVal Setting As String, ByVal Value As Object)
WritePrivateProfileString(Key, Setting, Value, Filename)
End Sub
Private Sub save_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles save.Click
SaveINISetting("C:\Program Files\Silkroad\C19H28O2.ini", "Options", "Zoomhack", zoom.CheckState)
SaveINISetting("C:\Program Files\Silkroad\C19H28O2.ini", "Options", "NudePatch", nude.CheckState)
SaveINISetting("C:\Program Files\Silkroad\C19H28O2.ini", "Options", "NoDC", disc.CheckState)
SaveINISetting("C:\Program Files\Silkroad\C19H28O2.ini", "Options", "ChatFilter", chat.CheckState)
MsgBox("Config successfully saved!")
End Sub
Private Sub launch_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles launch.Click
Dim ofd As New OpenFileDialog
ofd.Filter = "EXE File (*.exe)|*.exe"
ofd.Title = "Select Loader.exe"
ofd.ShowDialog()
If ofd.FileName <> "" Then
Process.Start(ofd.FileName)
Else
'User cancelled the dialog
End If
End Sub
Private Sub leave_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles leave.Click
Me.Close()
End Sub
Private Sub link_LinkClicked(ByVal sender As System.Object, ByVal e As System.Windows.Forms.LinkLabelLinkClickedEventArgs) Handles link.LinkClicked
Process.Start("http://www.7knights.co.nr")
End Sub
Private Sub info_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles info.Click
MsgBox("Point your browser to C19H28O2's Loader.exe V-2.0")
End Sub
End Class
Heres the project if you want it...
http://rapidshare.com/files/79548144/7K_Launcher.rar
-
Dec 31st, 2007, 07:17 AM
#2
Hyperactive Member
Re: [2008] Help updating some things
If your only saving the state of four check boxes it would be pretty straightforward to use My.Settings instead on an ini file.
If my post helps , please feel free to rate it 
-
Dec 31st, 2007, 07:19 AM
#3
Thread Starter
Member
Re: [2008] Help updating some things
the ini file has to be there... what changes would i have to make so that when you start up my program, that it would read the ini... and have the box checked if an option = 1?
-
Jan 1st, 2008, 11:17 PM
#4
Thread Starter
Member
Re: [2008] Help updating some things
-
Jan 3rd, 2008, 08:48 AM
#5
Thread Starter
Member
Re: [2008] Help updating some things
rawr i need help... im stuck and cant go any farther
-
Jan 3rd, 2008, 07:54 PM
#6
Re: [2008] Help updating some things
vb.net Code:
Public Class Form1
Public Declare Ansi Function GetPrivateProfileInt _
Lib "kernel32.dll" Alias "GetPrivateProfileIntA" _
(ByVal lpApplicationName As String, _
ByVal lpKeyName As String, ByVal nDefault As Integer, _
ByVal lpFileName As String) As Integer
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
checkbox1.value = CBool(GetPrivateProfileInt("Options", "Zoomhack", _
false, my.application.info.directorypath & "\C19H28O2.ini"))
'etc
End Sub
Private Sub save_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles save.Click
SaveINISetting(my.application.info.directorypath & "\C19H28O2.ini", "Options", "Zoomhack", zoom.CheckState)
SaveINISetting(my.application.info.directorypath & "\C19H28O2.ini", "Options", "NudePatch", nude.CheckState)
SaveINISetting(my.application.info.directorypath & "\C19H28O2.ini", "Options", "NoDC", disc.CheckState)
SaveINISetting(my.application.info.directorypath & "\C19H28O2.ini", "Options", "ChatFilter", chat.CheckState)
MsgBox("Config successfully saved!")
End Sub
- Coding Examples:
- Features:
- Online Games:
- Compiled Games:
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|