|
-
Oct 12th, 2000, 10:38 AM
#1
Thread Starter
New Member
Hi,
I'm creating a program for resistor values and I want the users be able to create/edit an INI-file for their language, but I can't find source code to use this on my form. I'm thinking about the Tag-property, but does anyone have good code, I can use?
Thnx
Live Long and Prosper,
Leo Schelvis
[ECH]
VB6
-
Oct 13th, 2000, 11:39 PM
#2
To read/write an INI file:
Code:
Public 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 Long, ByVal lpFileName As String) As _
Long
Public Declare Function WritePrivateProfileString _
Lib "kernel32" Alias "WritePrivateProfileStringA" (ByVal _
lpApplicationName As String, ByVal lpKeyName As Any, ByVal _
lpString As Any, ByVal lpFileName As String) As Long
Public Function ReadINI(strsection As String, strkey As String, strfullpath As String) As String
Dim strbuffer As String
Let strbuffer$ = String$(750, Chr$(0&))
Let ReadINI$ = Left$(strbuffer$, GetPrivateProfileString(strsection$, ByVal LCase$(strkey$), "", strbuffer, Len(strbuffer), strfullpath$))
End Function
Public Sub WriteINI(strsection As String, strkey As String, strkeyvalue As String, strfullpath As String)
Call WritePrivateProfileString(strsection$, UCase$(strkey$), strkeyvalue$, strfullpath$)
End Sub
Usage
Private Sub Command1_Click()
'Write
lang = InputBox("What language will you be using for the duration of the program?")
If lang <> "" Then
Call WriteINI("Language.ini", "Language", "" & lang & "", "C:\Language.ini")
Else
Exit Sub
End If
Private Sub Form_Load()
'Read
x = ReadINI("Language.ini", "Language", "C:\Language.ini")
Msgbox "Language: " & x
End Sub
Perhaps you should give a list of languages.
-
Oct 14th, 2000, 12:56 AM
#3
Frenzied Member
Ressource files are kind of powerful for multi language support!
I'd use just a text file not an ini file but doesn't really matter
Sanity is a full time job
Puh das war harter Stoff!
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
|