[2 days left] What’s wrong with your cloud strategy? Learn why multicloud solutions matter with Nimble Storage.Register Now

x
?
Solved

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

Posted on 2002-04-17
5
Medium Priority
?
142 Views
Last Modified: 2010-04-04
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
Comment
Question by:bloodbird
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
  • 2
5 Comments
 
LVL 5

Expert Comment

by:Gwena
ID: 6948294
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
 

Author Comment

by:bloodbird
ID: 6949700
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
 
LVL 5

Accepted Solution

by:
Gwena earned 400 total points
ID: 6952677
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
 
LVL 5

Expert Comment

by:Gwena
ID: 6952689
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
 

Author Comment

by:bloodbird
ID: 6970424
hi, Gwena,
  thank you very much , your code is good :)
0

Featured Post

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

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.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

The uses clause is one of those things that just tends to grow and grow. Most of the time this is in the main form, as it's from this form that all others are called. If you have a big application (including many forms), the uses clause in the in…
Introduction Raise your hands if you were as upset with FireMonkey as I was when I discovered that there was no TListview.  I use TListView in almost all of my applications I've written, and I was not going to compromise by resorting to TStringGrid…
How to fix incompatible JVM issue while installing Eclipse While installing Eclipse in windows, got one error like above and unable to proceed with the installation. This video describes how to successfully install Eclipse. How to solve incompa…
This lesson discusses how to use a Mainform + Subforms in Microsoft Access to find and enter data for payments on orders. The sample data comes from a custom shop that builds and sells movable storage structures that are delivered to your property. …
Suggested Courses

656 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question