Fito
1 de septiembre de 2017, 16:38
Hola Amigos:
Buscando información en la web encontré este código en visual basic para leer archivos ini por medio de winapi. Es posible traducirla a Cobol?
Option Explicit
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 Leer_INI(Filename As String, Key_Value As String, Key_Name As String, Optional ByVal Default As String) As String
Dim Size As Integer
Dim Value As String
Value = Space(255)
Size = GetPrivateProfileString(Key_Value, Key_Name, "", Value, Len(Value), Filename)
If Size > 0 Then Leer_INI = Left$(Value, Size) Else Leer_INI = Default
End Function
Public Function Escribir_INI(Filename As String, Key_Value As String, Key_Name As String, Value As String) As Long
Dim Size As Integer
Size = WritePrivateProfileString(Key_Value, Key_Name, Value, Filename)
End Function
Saludos...
Fito...
Buscando información en la web encontré este código en visual basic para leer archivos ini por medio de winapi. Es posible traducirla a Cobol?
Option Explicit
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 Leer_INI(Filename As String, Key_Value As String, Key_Name As String, Optional ByVal Default As String) As String
Dim Size As Integer
Dim Value As String
Value = Space(255)
Size = GetPrivateProfileString(Key_Value, Key_Name, "", Value, Len(Value), Filename)
If Size > 0 Then Leer_INI = Left$(Value, Size) Else Leer_INI = Default
End Function
Public Function Escribir_INI(Filename As String, Key_Value As String, Key_Name As String, Value As String) As Long
Dim Size As Integer
Size = WritePrivateProfileString(Key_Value, Key_Name, Value, Filename)
End Function
Saludos...
Fito...