10-02-2009, 02:56 AM
I have done much with my copy of ms 3.0.3. But when i try to add
To my source it highlight the Declare Function lines and says only comments may be place after end sub, or end function. Can any one please point me in the right direction. I tried it in both server and client. Please help cause this is for learning purposes and I have been playing with it for 45 mins and can't solve it.
Code:
Declare Function WritePrivateProfileString Lib "kernel32" Alias "WritePrivateProfileStringA" (ByVal lpApplicationname As String, ByVal lpKeyname As Any, ByVal lpString As String, ByVal lpfilename As String) As Long
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
Function GetVar(File As String, Header As String, Var As String) As String
Dim sSpaces As String ' Max string length
Dim szReturn As String ' Return default value if not found
szReturn = ""
sSpaces = Space(5000)
Call GetPrivateProfileString(Header, Var, szReturn, sSpaces, Len(sSpaces), File)
GetVar = RTrim(sSpaces)
GetVar = Left(GetVar, Len(GetVar) - 1)
End Function
Sub PutVar(File As String, Header As String, Var As String, Value As String)
Call WritePrivateProfileString(Header, Var, Value, File)
End Sub
Code:
Declare Function WritePrivateProfileString Lib "kernel32" Alias "WritePrivateProfileStringA" (ByVal lpApplicationname As String, ByVal lpKeyname As Any, ByVal lpString As String, ByVal lpfilename As String) As Long
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