07-04-2009, 06:20 PM
They should if they're making a game-maker rather than a game.
Though I wouldn't suggest writeINI and readINI. Use getVar and putVar. It does the same thing, and the server already comes equipped with it. Why shouldn't the client follow suit?
Though I wouldn't suggest writeINI and readINI. Use getVar and putVar. It does the same thing, and the server already comes equipped with it. Why shouldn't the client follow suit?
Code:
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 String, ByVal lpfilename As String) As Long
' gets a string from a text file
Public 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 = vbNullString
sSpaces = Space$(5000)
Call GetPrivateProfileString$(Header, Var, szReturn, sSpaces, Len(sSpaces), File)
GetVar = RTrim$(sSpaces)
GetVar = Left$(GetVar, Len(GetVar) - 1)
End Function
' writes a variable to a text file
Public Sub PutVar(File As String, Header As String, Var As String, Value As String)
Call WritePrivateProfileString$(Header, Var, Value, File)
End Sub