Спасибо конечно за совет, а вот на VBSTREETS.RU даже кодом помогли, если кому нужен, вот он: ' В модуль *********************************************** Private Declare Function GetPrivateProfileInt Lib "kernel32" _ Alias "GetPrivateProfileIntA" _ (ByVal strSection As String, _ ByVal strKeyName As String, _ ByVal lngDefault As Long, _ ByVal strFileName As String) As Long Private Declare Function GetPrivateProfileString Lib "kernel32" _ Alias "GetPrivateProfileStringA" _ (ByVal strSection As String, _ ByVal strKeyName As String, _ ByVal strDefault As String, _ ByVal strReturned As String, _ ByVal lngSize As Long, _ ByVal strFileName As String) As Long Private Declare Function WritePrivateProfileString Lib "kernel32" _ Alias "WritePrivateProfileStringA" _ (ByVal strSection As String, _ ByVal strKeyNam As String, _ ByVal strValue As String, _ ByVal strFileName As String) As Long Public Function GetValueString(strSection As String, _ strKey As String, strFile As String) As String Dim strBuffer As String * 256 Dim intSize As Integer On Error GoTo PROC_ERR intSize = GetPrivateProfileString(strSection, strKey, "", _ strBuffer, 256, strFile) GetValueString = Left$(strBuffer, intSize) PROC_EXIT: Exit Function PROC_ERR: MsgBox "Ошибка: <" & Err.Number & "> - " & Err.Description, _ vbExclamation = vbOKOnly, "GetValueString" Resume PROC_EXIT End Function Public Function SetValue(strSection As String, strKey As String, _ strValue As String, strFile As String) As Integer Dim intStatus As Integer On Error GoTo PROC_ERR intStatus = WritePrivateProfileString(strSection, strKey, _ strValue, strFile) SetValue = (intStatus <> 0) PROC_EXIT: Exit Function PROC_ERR: MsgBox "Ошибка: <" & Err.Number & "> - " & Err.Description, _ vbExclamation = vbOKOnly, "SetValue" Resume PROC_EXIT End Function ' В форму ************************************************* Dim q as variant 'чтение GetValueString("Раздел", "Имя параметра", "Путь до ini") 'запись q = SetValue("Раздел", "Имя параметра", "Значение", "Путь до ini")
Ответить
|