![]() |
Chm dump
Liste der Anhänge anzeigen (Anzahl: 1)
Hi , i've this project ( attachment )that deals with Chm ( Help Files ) , It populates the Contents into the Treeview .
But what i want is to export ( save ) the Contents into a Directory instead of populating them , any help please . many thanks |
Re: Chm dump
Liste der Anhänge anzeigen (Anzahl: 1)
i'm very sorry , the attachment was empty .
please see the new attachment. sorry again . |
Re: Chm dump
Hello,
do you mean something like this?
Delphi-Quellcode:
procedure TFrmMain.btnSaveToDirClick(Sender: TObject);
Var i : Integer; sDir : String; begin If OpenDialog.FileName = '' Then OpenDialog.FileName := EditHelpFile.Text; sDir := ChangeFileExt(OpenDialog.FileName,''); If Not DirectoryExists(sDir) then CreateDir(sDir); For i := 0 To Tree.Items.Count - 1 do begin Tree.Items[i].Selected := True; TreeChange(Sender,Tree.Items[i]); If Memo.Lines.Count > 0 then Memo.Lines.SaveToFile(sDir + '\' + Tree.Items[i].Text); end; end; |
Re: Chm dump
many thanks nahpets , Is there any possibility to Save the IStorage Contents without using the Treeview at all .
thank you again |
Re: Chm dump
Hi i did it Now i can Export the IStorage elements to a Directory , but Why it doesn't export the SubStorage too ( Like Images , Jscripts .... ).
The Code to Export the IStorage Elemts is :
Delphi-Quellcode:
Usage :
procedure ExportStgElemets(const Source, DstDir: String);
var ITS: IITStorage; Root: IStorage; Enumerator: IEnumStatStg; Stat: TStatStg; Src, Dst: IStream; FileStream: TFileStream; S: WideString; BytesRead, BytesWritten: Int64; SubStorage: IStorage; begin { Create target directory } ForceDirectories(DstDir); { Open Source file } ITS := CoITStorage.Create; S := ArchiveFilename; OleCheck(ITS.StgOpenStorage(PWideChar(S),nil, STGM_READ or STGM_SHARE_DENY_WRITE,nil,0,Root)); { Enumerate streams in storage } OleCheck(Root.EnumElements(0,nil,0,Enumerator)); while Enumerator.Next(1,Stat,nil) = S_OK do begin if Stat.dwType = STGTY_STORAGE then begin OleCheck( Root.OpenStorage(Stat.pwcsName,nil, STGM_READ or STGM_DIRECT or STGM_SHARE_EXCLUSIVE,nil,0,SubStorage)) ; {* Here why it does't support the SubStorage *} end else begin { Open source stream in storage } OleCheck(Root.OpenStream(Stat.pwcsName,nil, STGM_READ or STGM_SHARE_DENY_WRITE,0,Src)); FileStream := TFileStream.Create(DstDir + Stat.pwcsName,fmCreate); Dst := TStreamAdapter.Create(FileStream,soOwned); { Copy source to destination } OleCheck(Src.CopyTo(Dst,Stat.cbSize,BytesRead,BytesWritten)); end; end; end;
Delphi-Quellcode:
Could any one Correct the Code so that the Procedure can Export the SubStorage Too ??
procedure TFrmMain.Button1Click(Sender: TObject);
begin ExportStgElemets(EditHelpFile.Text,'C:\test\'); end; Thank you |
Re: Chm dump
Hello,
a new version with export of SubStorage ( Like Images , Jscripts .... ). [Edit]new version with errorlogging[/Edit] |
Re: Chm dump
How can i thank you nahpets . :roll:
Many thanks |
Re: Chm dump
Just buy him a beer :zwinker:. If he does not want it, I will take it :lol:
|
Re: Chm dump
10 beers not only ONE :lol:
|
Re: Chm dump
okay, 10 beers for DeddyH :wink:
|
Alle Zeitangaben in WEZ +1. Es ist jetzt 09:52 Uhr. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
LinkBacks Enabled by vBSEO © 2011, Crawlability, Inc.
Delphi-PRAXiS (c) 2002 - 2023 by Daniel R. Wolf, 2024-2025 by Thomas Breitkreuz