* Create an object to handle the zip file oZHandler = CREATEOBJECT('ZipHandler') * Create an empty zip file called test.zip in C:\temp STRTOFILE('PK'+CHR(0x05)+CHR(0x06)+REPLICATE(CHR(0),18),'C:\temp\test.zip',0) * Create text files to play with STRTOFILE('Rubbish','C:\temp\fred.txt',0) STRTOFILE('More rubbish','C:\temp\joe.txt',0) SET STEP ON * Step over each line to see results WITH oZHandler * Place the two text files in the zip file .ZipName = 'C:\temp\test.zip' .AddToZip('C:\temp\fred.txt') .AddToZip('C:\temp\joe.txt') * Explore contents of the zip file .ExpZip() * View contents of the zip file .ViewZip() * Search contents of a zip file .SearchZip() * View contents of a text file .OpenFile('fred.txt') * Remove a file from the zip file .DelFromZip('joe.txt') * Remove next file from zip file .DelFromZip('fred.txt') ENDWITH RELEASE oZHandler DEFINE CLASS ZipHandler AS Custom ZipName = '' PROCEDURE Init lcLibHome= HOME(1)+'Gallery\_webview.vcx' SET CLASSLIB TO (lcLibHome) This.AddObject('oFrm','Form') This.oFrm.AddObject('oZip','_webbrowser4') ENDPROC PROCEDURE ZipName_Assign LPARAMETERS vNewVal This.ZipName = M.vNewVal This.oFrm.oZip.Navigate(This.ZipName) ENDPROC PROCEDURE AddToZip LPARAMETERS FileToAdd oDoc = This.oFrm.oZip.Document oFld = oDoc.Folder oFld.CopyHere(FileToAdd,0) RETURN PROCEDURE ExpZip oDoc = This.oFrm.oZip.Document oFld = oDoc.Folder oIts = oFld.Items oIts.Item.Verbs.Item[3].DoIt RETURN PROCEDURE ViewZip oDoc = This.oFrm.oZip.Document oFld = oDoc.Folder oIts = oFld.Items oIts.Item.Verbs.Item[0].DoIt RETURN PROCEDURE SearchZip oDoc = This.oFrm.oZip.Document oFld = oDoc.Folder oIts = oFld.Items oIts.Item.Verbs.Item[1].DoIt RETURN PROCEDURE OpenFile LPARAMETERS FileToOpen oDoc = This.oFrm.oZip.Document oFld = oDoc.Folder oIts = oFld.Items nIts = oIts.Count FOR t = 0 TO nIts-1 IF oIts.Item[t].Name = FileToOpen EXIT ENDIF ENDFOR oits.Item(t).Verbs.Item(0).DoIt RETURN PROCEDURE DelFromZip LPARAMETERS FileToDel oDoc = This.oFrm.oZip.Document oFld = oDoc.Folder oIts = oFld.Items nIts = oIts.Count FOR t = 0 TO nIts-1 IF oIts.Item[t].Name = FileToDel EXIT ENDIF ENDFOR oits.Item(t).Verbs.Item(3).DoIt RETURN ENDDEFINE