Login  
Search All Forums
Dart Home | PowerTCP Zip Compression for Active | Custom Development Reply | PowerTCP Zip Compression for ActiveX Topics | Forums   
AuthorForum: PowerTCP Zip Compression for ActiveX
Topic: FileStore.Count appears incorrect
ssanders55

From: Killeen, TX USA
Posts: 2
Member Since: 09/20/06
posted December 28, 2006 2:07 PM

Using VB6 with the Zip ActiveX control, I've created a generic function to unzip specific files from a given archive. The first time the function is called everything works as expected. On subsequent calls, the FileStore.Count property appears to have been added to the previous value. After a number of calls to this function, the program chokes because the count value exceeds the integer boundary. Here is the code I am using:

*****************
Public Function UnZipFile( _
  ByVal inpArchiveLocation As String, _
  ByVal inpFileName As String, _
  ByVal inpSaveDir As String, _
  ByVal inpCallingFunction As String _
) As Long

Dim FileIndex As Integer
Dim intLoop As Integer
Dim Msg As String

  On Error GoTo UnZipFile_Error
  FileIndex = 0
  zipEncrypt.FileStore.Load inpArchiveLocation
  For intLoop = 1 To zipEncrypt.FileStore.Count
    If UCase(zipEncrypt.FileStore(intLoop).Name) = UCase(inpFileName) Then
      FileIndex = intLoop
      Exit For
    End If
  Next intLoop
  If FileIndex = 0 Then
    Err.Raise 8800, "frmCAPTURE:UnZipFile", "File not found in archive."
  End If
  zipEncrypt.FileStore(FileIndex).Extract inpSaveDir

UnZipFile_Error:
  UnZipFile = Err.Number
  If Err.Number <> 0 Then
    Msg = "Error: " & Format(Err.Number) & " - " & Err.Description & _
      " (" & inpFileName & ")"
    Call GenerateMessage(Msg, 0, inpCallingFunction)
  End If
End Function
*****************

Any ideas about what can be causing this issue?

Thanks! 
\Steve
Amit

From: Rome, NY USA
Posts: 315
Member Since: 03/15/06
posted January 2, 2007 12:11 PM

Hello Steve,

Going through the code snippet, it seems that you are not removing the object from the Collection. I would suggest you to use FileStore.Clear method before any other archive are added to the FileStore.

Wish you a Happy New Year.

Regards,
Amit
ssanders55

From: Killeen, TX USA
Posts: 2
Member Since: 09/20/06
posted January 4, 2007 3:16 PM

Well, that was rediculously simple. <blush> I appreciate the help! It works like a champ now.
Amit

From: Rome, NY USA
Posts: 315
Member Since: 03/15/06
posted January 4, 2007 5:29 PM

It is nice to hear that the response was helpful.

Do let me know if you require further assistance/ clarifications.

Regards,
Amit
Reply | PowerTCP Zip Compression for ActiveX Topics | Forums   
This site is powered by PowerTCP WebServer Tool PowerTCP WebServer for ActiveX