G
Guest
I don't know if this can be done, but here goes...
The following is a code snippet from VB 6 that I used to read/write to INI
files. Is it possible to create a DLL with .NET and use it with VBScript?
Where would I begin?
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 GetINIInfo(ByVal sSection As String, ByVal sKeyWord As
String, _
ByVal sDefVal As String, ByVal sINIFile As String) As String
Dim sTempVar As String * 256
Dim lRet As Long
'Get value from INI file
lRet = GetPrivateProfileString(CStr(sSection), CStr(sKeyWord),
CStr(sDefVal), sTempVar, 256, CStr(sINIFile))
'Strip off NULL and return value
If lRet > 0 Then
GetINIInfo = RTrim(Left$(Mid$(sTempVar, 1, lRet), InStr(sTempVar,
Chr$(0)) - 1))
Else
GetINIInfo = ""
End If
End Function
Public Function WriteINIInfo(ByVal sSection As String, ByVal sKeyWord As
String, _
ByVal sValue As String, ByVal sINIFile As String) As String
WriteINIInfo = WritePrivateProfileString(CStr(sSection), CStr(sKeyWord),
CStr(sValue), CStr(sINIFile))
End Function
The following is a code snippet from VB 6 that I used to read/write to INI
files. Is it possible to create a DLL with .NET and use it with VBScript?
Where would I begin?
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 GetINIInfo(ByVal sSection As String, ByVal sKeyWord As
String, _
ByVal sDefVal As String, ByVal sINIFile As String) As String
Dim sTempVar As String * 256
Dim lRet As Long
'Get value from INI file
lRet = GetPrivateProfileString(CStr(sSection), CStr(sKeyWord),
CStr(sDefVal), sTempVar, 256, CStr(sINIFile))
'Strip off NULL and return value
If lRet > 0 Then
GetINIInfo = RTrim(Left$(Mid$(sTempVar, 1, lRet), InStr(sTempVar,
Chr$(0)) - 1))
Else
GetINIInfo = ""
End If
End Function
Public Function WriteINIInfo(ByVal sSection As String, ByVal sKeyWord As
String, _
ByVal sValue As String, ByVal sINIFile As String) As String
WriteINIInfo = WritePrivateProfileString(CStr(sSection), CStr(sKeyWord),
CStr(sValue), CStr(sINIFile))
End Function