• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 143
  • Last Modified:

how to make several html page into one file , and then read it in my program?

how to make several html page into one file , and then read it in my program?

i have some html file , and i want pack them into one
file, then use WebBrowser vcl compenent show them by
a certain order.

could you help me ?
0
bloodbird
Asked:
bloodbird
  • 3
  • 2
1 Solution
 
GwenaCommented:
Huh?

If you actually just want to join several html pages together...like concatinating strings.. and then display the result..then that won't work well :-)

If you want to take several html pages and somehow add them to your exe file and then display them at run time...then that is pretty easy... but I do it by just calling the default web browser to display the pages...I extract the pages into windows/temp  it works well.

If webbrowser vcl can show a page held in a stream then you could do that and never write the html to the disk...

If this is the sort of thing you want to do let me know and I will send you some demo code.  I made a little program that stores a copy of a website inside of itself..then extracts and displays it by clicking a button :-)
0
 
bloodbirdAuthor Commented:
hi! Gwena

  That is what i want , if it can show a page held in
stream ,that could be wonderful ,

where is your code ?

my email address : kisskiller@163.net

very thank you
0
 
GwenaCommented:
Hi :-)

 I am mailing you a demo to kisskiller@163.net

  I included all source and 2 exe demos... one is just the compiled source...and the other is the same exe but I have run the program and stuffed a small website into it... just push the button and it will display :-)

  Be sure and read the comments inside ExeMod.pas .. especially if you use NT/2000/XP  !

  I did this demo for someone else a while back..but it seems to fit your needs well so I just modified it slightly for your use.

  You can put any sort of files into this... you can put all the files for a huge delphi project and extract them with a single button push... just remember that the FIRST file you stuff into the archive will be the item that is extracted and executed at runtime!! this can be anything at all... exe,htm/l,pdf,ra... anything :-)

  Here is the source for the demo.... I hope it formats correctly..sometimes it doesn't when you post it here on EE



unit Unit1;

interface

uses
  Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
  ExtCtrls, ExeMod, Buttons, ShellAPI;

type
  TForm1 = class(TForm)
    SpeedButton1: TSpeedButton;
    SpeedButton2: TSpeedButton;
    OpenDialog1: TOpenDialog;
    SpeedButton3: TSpeedButton;
    procedure SpeedButton1Click(Sender: TObject);
    procedure SpeedButton2Click(Sender: TObject);
    procedure SpeedButton3Click(Sender: TObject);
    procedure FormDblClick(Sender: TObject);
    procedure FormCreate(Sender: TObject);
  private
    { Private declarations }
  public
    { Public declarations }
  end;

var
  Form1: TForm1;
  Count: Integer;  //this variable holds the number of files added to the exe

implementation

{$R *.DFM}

//This procedure handles adding a file to an ebook exe
//==============================================================================
procedure TForm1.SpeedButton1Click(Sender: TObject);
Var Temp: String;
begin

if Exe = '' then ReadExe;    //These 2 lines make sure that a new file cannot
if Exe[3] <> 'P' then Exit;  //be added to a finalized ebook..

OpenDialog1.Execute;
If OpenDialog1.FileName <> '' then
begin
  Add2Exe('E-BookFileName'+IntToStr(Count),ExtractFileName(OpenDialog1.FileName));
  AddFile2Exe('E-BookFile'+IntToStr(Count),OpenDialog1.FileName);
  Inc(Count);
end;
end;
//==============================================================================



//This procedure rebuilds the exe at runtime by adding all the files.
//==============================================================================
procedure TForm1.SpeedButton2Click(Sender: TObject);
Var Temp: String;
begin
ExtractFromExe('E-BookFileName0',Temp);
If Temp = '' then Exit;
Exe[3] := Chr(Count);
AlterExe;
end;
//==============================================================================



//This procedure extracts a finished ebook to disk and views it with browser..
//the first file you stuffed into the ebook is what will be executed so make
//certain you put the main page as the first saved file... usually this is
//index.htm/l  ... but it could be anything at all... including another exe :-)
//==============================================================================
procedure TForm1.SpeedButton3Click(Sender: TObject);
Var
Temp: String;
X,Y: Byte;
begin
ReadExe;
If Exe[3] = 'P' then Exit;
Y := ord(Exe[3])-1;
For X := 0 to Y do
begin
  ExtractFromExe('E-BookFileName'+IntToStr(X),Temp);
  Extract2File('E-BookFile'+IntToStr(X),Temp);
end;
ExtractFromExe('E-BookFileName0',Temp);
ShellExecute(Form1.Handle,nil,pchar(Temp),
nil,nil, SW_SHOWNORMAL);
end;
//==============================================================================



//This procedure returns the running exe to its original state .. to activate
//this just double click somewhere on the form of either a finalized ebook
//or do it if you make a mistake while building an ebook and want to start over.
//==============================================================================
procedure TForm1.FormDblClick(Sender: TObject);
Var
Temp: String;
X,Y: Byte;
begin
Y := ord(Exe[3])-1;
For X := 0 to Y do
begin
  DelFromString('E-BookFileName'+IntToStr(X),Exe);
  DelFromString('E-BookFile'+IntToStr(X),Exe);
  Exe[3] := 'P';
end;
AlterExe;
end;
//==============================================================================



//This procedure always runs first and it checks to see if the exe is a
//finalized ebook... if it is it alters the appearance of the form to reflect
//that fact :-)
//==============================================================================
procedure TForm1.FormCreate(Sender: TObject);
begin
ReadExe;
if Exe[3] <> 'P' then
begin
  Form1.Height := 85;
  SpeedButton3.Top := 14;
  Form1.Color := $00BFDABA;
  SpeedButton3.Visible := True;
  SpeedButton1.Visible := False;
  SpeedButton2.Visible := False;
end;
end;
//==============================================================================

end.






0
 
GwenaCommented:
Oh...

I just had the demo extract the files to the current directory... you could extract them to windows/temp just as easily ...  sorry about not giving demo code for viewing the html pages from a stream.. but I only have the free D6 personal and D2 standard... so I can't try out using Webrowser vcl.... I'm not sure if it can do this anyway. There is a shareware component that can... at least I seem to remember seeing one somewhere :-)
0
 
bloodbirdAuthor Commented:
hi, Gwena,
  thank you very much , your code is good :)
0

Featured Post

Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

  • 3
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now