Question and Answer Database FAQ729D.txt Using the LzExpand functions in your applications Category :Windows API Platform :All Product :All 32 bit Question: How do I use the LzExpand functions in my application? Answer: Here is an example that will decompress a file that was compressed using the Microsoft compress.exe utility utilizing the -r (rename) command line switch. Note: If you already know the expanded name of the file, or it was not compressed with the -r command line switch, then simply omit the code associated with the GetExpandedName function, and directly hard code the file name as needed. uses LzExpand; {$IFNDEF WIN32} const MAX_PATH = 144; {$ENDIF} procedure TForm1.Button1Click(Sender: TObject); var lpDstFileName : PChar; SrcFile : integer; DstFile : integer; SrcOs : TOFSTRUCT; DstOs : TOFSTRUCT; begin GetMem(lpDstFileName, MAX_PATH); GetExpandedName('C:\TestFile.bi_', lpDstFileName); SrcFile := LZOpenFile('C:\TestFile.bi_', SrcOs, OF_READ); DstFile := LZOpenFile(lpDstFileName, DstOs, OF_CREATE); LZCopy(SrcFile, DstFile); LZClose(SrcFile); LZClose(DstFile); FreeMem(lpDstFileName, MAX_PATH); end; 7/16/98 4:31:28 PM
Last Modified: 01-SEP-99