重庆分公司,新征程启航
为企业提供网站建设、域名注册、服务器等服务
VB.NET读写INI配置文件
创新互联是一家集网站建设,金凤企业网站建设,金凤品牌网站建设,网站定制,金凤网站建设报价,网络营销,网络优化,金凤网站推广为一体的创新建站企业,帮助传统企业提升企业形象加强企业竞争力。可充分满足这一群体相比中小企业更为丰富、高端、多元的互联网需求。同时我们时刻保持专业、时尚、前沿,时刻以成就客户成长自我,坚持不断学习、思考、沉淀、净化自己,让我们为更多的企业打造出实用型网站。
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
Dim path As String
path = Application.StartupPath + "\Send.ini"
TextBox1.Text = GetINI("Send", "Send1", "", path)
TextBox2.Text = GetINI("Send", "Send2", "", path)
Dim IsSms As Integer = GetINI("Send", "IsSms", "", path)
If (IsSms = 1) Then
Me.RadioButton1.Checked = True
ElseIf (IsSms = 0) Then
Me.RadioButton2.Checked = True
End If
End Sub
Public Function GetINI(ByVal Section As String, ByVal AppName As String, ByVal lpDefault As String, ByVal FileName As String) As String
Dim Str As String = LSet(Str, 256)
GetPrivateProfileString(Section, AppName, lpDefault, Str, Len(Str), FileName)
Return Microsoft.VisualBasic.Left(Str, InStr(Str, Chr(0)) - 1)
End Function
Public Function WriteINI(ByVal Section As String, ByVal AppName As String, ByVal lpDefault As String, ByVal FileName As String) As Long
WriteINI = WritePrivateProfileString(Section, AppName, lpDefault, FileName)
End Function
Private Declare Function GetPrivateProfileString Lib "kernel32" Alias "GetPrivateProfileStringA" (ByVal lpApplicationName As String, ByVal lpKeyName As String, ByVal lpDefault As String, ByVal lpReturnedString As String, ByVal nSize As Int32, ByVal lpFileName As String) As Int32
Private Declare Function WritePrivateProfileString Lib "kernel32" Alias "WritePrivateProfileStringA" (ByVal lpApplicationName As String, ByVal lpKeyName As String, ByVal lpString As String, ByVal lpFileName As String) As Int32
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Try
Dim path As String
path = Application.StartupPath + "\Send.ini"
WriteINI("Send", "Send1", TextBox1.Text, path)
WriteINI("Send", "Send2", TextBox2.Text, path)
If (Me.RadioButton1.Checked = True) Then
WriteINI("Send", "IsSms", 1, path)
ElseIf (Me.RadioButton2.Checked = True) Then
WriteINI("Send", "IsSms", 0, path)
End If
MsgBox("配置设置已经成功!!!!")
Catch ex As Exception
MsgBox("错误!!!!")
End Try
End Sub
做数字编程的电脑比做图形编程的电脑配置要求要低的多,只要内存够大就可以,集成显卡的都能跑。如果对显示器没要求(不是必须要LCD的,为眼睛考虑,那么买600块的17寸CRT的),整个配置1800都拿的下来。
如要配置单,请楼主回。
去下载一个EVEREST,这个就是一款硬件识别软件,然后你用C语言或其他的编程工具将它拆开,你不就知道,那玩意是怎么编出来的了吗。
Windows 提供了专门的 UserData 目录用来存放程序需要读写的文件(你会发现很多游戏存档都在这个目录底下),访问这个目录是不需要管理员权限的,你可以在这个目录下建一个你的程序专属的文件夹,往里面存放文件。
默认是在 C:\ProgramData(如果是 XP 的话是 C:\Documents and Settings)下。但一般不建议硬编码这个地址,一来你还得自行判断操作系统版本,二来用户是可以修改这个目录的路径的。
好在系统提供了一个环境变量 %ProgramData% 来指向这个地址,用它就可以了。