Ini ada conto pake API :
File INI tidak sama dengan file text biasa. Karena file INI berisi
seting seting yang bisa di kustomisasi dengan pemberian TAG pada tiap
setingnya.
di coba aja pada aplikasinya dan bedakan dengan setting yang di taruh pada
file TEXT biasa. :-)
------------
Salin semua ini di module.
Private Declare Function GetPrivateProfileString Lib "kernel32" Alias
"GetPrivateProfileStringA" (ByVal lpApplicationName As String, ByVal
lpKeyName As Any, ByVal lpDefault As String, ByVal lpReturnedString As
String, ByVal nSize As Long, ByVal lpFileName As String) As Long
Private 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 writeINI(ByVal ApplicationName As String, ByVal strKeyName
As String, ByVal strValue As String, ByVal INIfile As String) As Boolean
On Error GoTo err1
writeINI = False
Dim Ret As String, NC As Long
WritePrivateProfileString ApplicationName, strKeyName, strValue, INIfile
writeINI = True
Exit Function
err1:
writeINI = False
End Function
Public Function readINI(ByVal ApplicationName As String, ByVal strKeyName As
String, ByVal INIfile As String, returnValue As String) As Boolean
On Error GoTo err1
readINI = False
Dim Ret As String, NC As Long
Ret = String(255, 0)
NC = GetPrivateProfileString(ApplicationName, strKeyName, "Default",
Ret, 255, INIfile)
If NC <> 0 Then Ret = Left$(Ret, NC)
returnValue = Ret
readINI = True
Exit Function
err1:
readINI = False
End Function
----- Original Message -----
From: "Shinta Nurhariyanti" <[EMAIL PROTECTED]>
To: <[email protected]>
Sent: Friday, July 08, 2005 08:54
Subject: [Programmer-VB] Re: Mengolah ini file
> Yang saya tahu caranya sama dengan mengakses file txt.
> kira2 seperti ini:
>
> dim ln as string
> dim filename as string
>
> filename=...(isi dengan nama file, misal :tes.ini)
>
> 'untuk membuka file
> open filename for input as #1
>
> 'untuk membaca isi file perbaris
> do until eof(1)
> 'setiap baris diisikan di varible ln
> Input #1, ln
> loop
> close #1
>
> Untuk membuat file *.ini :
>
> open filename gor output as #1
> print #1, ".." (isi dengan teks yang akan diisikan pada file
> close #1
>
>
>
>
>
>
> Untuk keluar dari millis ini, kirim email kosong ke:
> [EMAIL PROTECTED]
>
>
> Yahoo! Groups Links
>
>
>
>
>
>
>
>
>
Untuk keluar dari millis ini, kirim email kosong ke:
[EMAIL PROTECTED]
Yahoo! Groups Links
<*> To visit your group on the web, go to:
http://groups.yahoo.com/group/Programmer-VB/
<*> To unsubscribe from this group, send an email to:
[EMAIL PROTECTED]
<*> Your use of Yahoo! Groups is subject to:
http://docs.yahoo.com/info/terms/