Sun Nov 28, 2004 9:51 am by WatercoolerWarrior
If by "Flik Codec" you mean the flcodec.dll, then here's how I do it in a class I've put together for portable use. THis SHOULD work as copy-paste code in a VB6 app; you may want to remove the "Public Enum FlCodecErrors" and turn the stuff inside into constants if you're handling all of it inside your own application.
<pre><font size=1 face=Courier>
Option Explicit
Private Declare Function flcodec Lib "flcodec" _
(ByVal codecFlag As Long, ByVal sourcePath As String, _
ByVal targetPath As String) As Long
' flcodec flags
Private Const FLCODEC_DECODE = &H1
Private Const FLCODEC_ENCODE = &H2
' flcodec return errors; made into a public enum for easier use from
' non-latebound COM clients.
Public Enum FlCodecErrors
FLCODECERR_OK = 0
FLCODECERR_FILEOPENFAILED = &H100
FLCODECERR_MEMORYALLOCFAILED = &H101
FLCODECERR_FILEREADFAILED = &H102
' integer 259; happens if the target file cannot be created.
' One cause is a bogus filename.
FLCODECERR_FILECREATEFAILED = &H103
FLCODECERR_FILEWRITEFAILED = &H104
FLCODECERR_INVALIDARGUMENT = &H105
' integer 262; the source file name is bad.
FLCODECERR_INVALIDFILENAME = &H106
'263 integer; this isn't an encoded savegame file.
FLCODECERR_NOTFLS1FILE = &H107
End Enum
Public Property Get LastCodecError() As Long
LastCodecError = MyLastCodecError
End Property
Public Function DecodeSaveGame(ByVal sourcePath As String, _
ByVal targetPath As String) As Boolean
MyLastCodecError = flcodec(FLCODEC_DECODE, sourcePath, targetPath)
If MyLastCodecError = 0 Then
DecodeSaveGame = True
Else
DecodeSaveGame = False
End If
End Function
Public Function EncodeSaveGame(ByVal sourcePath As String, _
ByVal targetPath As String) As Boolean
MyLastCodecError = flcodec(FLCODEC_ENCODE, sourcePath, targetPath)
If MyLastCodecError = 0 Then
EncodeSaveGame = True
Else
EncodeSaveGame = False
End If
End Function
</font></pre>
For this to work, flcodec just needs to be accessible to your application; the best method IMO is to stick it in the same folder as your app. There are possible side effects to trying to place it in the system32 folder.