아는데로 참고만 하세요.
모르면 걍 스킵하시구요.. ㅋㅋㅋ
프로그래밍 하면서 INI파일 이용하는데 편리하긴 하더군요.
초보들만 보시면 될듯..
영어 잘 읽어보면 언제 누가 맹글었다고 다있네요. ㅎㅎㅎ
모르면 걍 스킵하시구요.. ㅋㅋㅋ
프로그래밍 하면서 INI파일 이용하는데 편리하긴 하더군요.
초보들만 보시면 될듯..
영어 잘 읽어보면 언제 누가 맹글었다고 다있네요. ㅎㅎㅎ
[CODE] =============================================================================== Attribute VB_Name = "INIFILES" '**************************************************** '* INIFILES.BAS Version 2.0 Date: 02/01/95 * '* VB Tips & Tricks * '* 8430-D Summerdale Road San Diego CA 92126-5415 * '* Compuserve: 74227,1557 * '* America On-LineS: DPMCS * '* InterNet: DPMCS@AOL.COM * '**************************************************** Option Explicit 'Global PlayPath As String #If Win16 Then Declare Function WritePrivateProfileString Lib "KERNEL" (ByVal AppName$, ByVal KeyName$, ByVal keydefault$, ByVal FileName$) As Integer Declare Function GetPrivateProfileString Lib "KERNEL" (ByVal AppName$, ByVal KeyName$, ByVal keydefault$, ByVal ReturnString$, ByVal NumBytes As Integer, ByVal FileName$) As Integer #Else Declare Function WritePrivateProfileString Lib "kernel32" Alias "WritePrivateProfileStringA" (ByVal AppName$, ByVal KeyName$, ByVal keydefault$, ByVal FileName$) As Long Declare Function GetPrivateProfileString Lib "kernel32" Alias "GetPrivateProfileStringA" (ByVal AppName$, ByVal KeyName$, ByVal keydefault$, ByVal ReturnString$, ByVal NumBytes As Long, ByVal FileName$) As Long #End If Function GetINI(Division As String, KeyName As String, INIPath As String) As String Dim ii As Integer Dim kk As Integer Dim sRet As String If INIPath = "" Then MsgBox "환경 설정 화일이 업습니다." GetINI = "" End If sRet = String(255, Chr(0)) ii = GetPrivateProfileString(Division, KeyName, "", sRet, Len(sRet), INIPath) kk = InStr(sRet, Right(sRet, 1)) GetINI = Left(sRet, kk% - 1) End Function '******************************************************* '* Procedure Name: sReadINI * '*Returns a string from an INI file. To use, call the * '*functions and pass it the AppName, KeyName and INI * '*File Name, [sReg=sReadINI(App1,Key1,INIFile)]. If you * '*need the returned value to be a integer then use the * '*val command. * '******************************************************* Function ReadINI(KeyName As String) As String Dim ii As Integer Dim kk As Integer Dim sRet As String Dim FileName As String Dim AppName As String AppName = "PlayPath" FileName = "C:mt.ini" sRet = String(255, Chr(0)) ii = GetPrivateProfileString(AppName, KeyName, "", sRet, Len(sRet), FileName) kk = InStr(sRet, Right(sRet, 1)) ReadINI = Mid(sRet, 1, kk% - 1) End Function '******************************************************* '* Procedure Name: WriteINI * '*-----------------------------------------------------* '* Created: 2/10/94 By: David McCarter * '* Modified: By: * '*=====================================================* '*Writes a string to an INI file. To use, call the * '*function and pass it the sAppname, sKeyName, the New * '*String and the INI File Name, * '*[R=WriteINI(App1,Key1,sReg,INIFile)]. Returns a 1 if * '*there were no errors and a 0 if there were errors. * '******************************************************* Sub WriteINI(Division As String, KeyName As String, NewString As String, INIPath As String) Dim R As Integer If INIPath = "" Then INIPath = App.Path & "line.ini" End If R = WritePrivateProfileString(Division, KeyName, NewString, INIPath) End Sub [/CODE]