L505 wrote:

Well I like having the HTML available that I can edit in a source file
in case I need to print the documents and the current format is not
good for my printer. Sometimes I change the font size of the documents
so I don't waste as much paper. I don't like having the file hidden in
some CHM file that I can never have access to with my bare hands.
If there is a CHM decompiler that is legal to use and not illegal then
that would be good. Or if you offered HTML and CHM that would
be good - can you extract all the HTML out of CHM legally?
Because one time I tried to decompile a HLP file and it turned out
to be a huge mess.
In your lazarus directory /components/chmhelp/packages/chm/ there is a unit called chmreader. It is simple to get a list of any of the files in the chm and extracting them:

var
 Reader: TChmReader;
 Stream: TMemoryStream;
 TmpStream: TMemoryStream;
 X: Integer;
 AList: StringList;
begin
 Stream := TMemoryStream.Create;
 Stream.LoadFromFile('myfile.chm');
Reader := TChmReader.Create(Stream, True); // the second param frees the stream when the reader object is destroyed
 AList := TStringList.Create;
 Reader.GetCompleteFileList(AList);
 for X := 0 to AList.Count-1 do begin
   TmpStream := Reader.GetObject(AList.Strings[X]);
   // do something with the file
if Assigned(TmpStream) then TmpStream.Free; end;
end;

That's how easy it is to get all the files out of a chm :)

Andrew Haines

_________________________________________________________________
    To unsubscribe: mail [EMAIL PROTECTED] with
               "unsubscribe" as the Subject
  archives at http://www.lazarus.freepascal.org/mailarchives

Reply via email to