|
Dera Ross,
Have a look here : http://www.helpware.net/delphi/index.html
and at their group site for down loads (free): http://groups.yahoo.com/group/DelphiHHKit/
As I recall it this was the info I read and
followed in setting the CHM Help system up,
// 1. Use the unit (hh.pas) and declare a
global
USES HH, HH_FUNCS;
//Global varible
var mHHelp: THookHelpSystem; // 2. Create the Object in main form
create.
procedure TMainForm.FormCreate(Sender: TObject); begin mHHelp := THookHelpSystem.Create(pathToCHM, '', htHHAPI); ... // 3. Free the object in main form
destroy
procedure TMainForm.FormDestroy(Sender: TObject); begin //Unhook and free mHHelp.Free; HHCloseAll; //Close help before shutdown or big trouble ... Then you need to create you ALIAS and MAP files for use
in the CHM making process. After that your HHP and HHC (see below).
These file excerpts are a dummy run I did
An Alias File takes this form, it points a variable to the
actual help HTM that is being compiled into the CHM
ALIAS File:
IDH_Button1=1011_Trymake -
Trymake_Button1.htm
IDH_Panel1=1002_Trymake - Trymake_Panel1.htm IDH_CheckListBox1=1001_Trymake - Panel1_CheckListBox1.htm IDH_Button2=1010_Trymake - Trymake_Button2.htm IDH_STFontsList1=1003_Trymake - Trymake_STFontsList1.htm IDH_PageControl1=1005_Trymake - Trymake_PageControl1.htm IDH_TabSheet1=1006_Trymake - PageControl1_TabSheet1.htm IDH_TabSheet2=1008_Trymake - PageControl1_TabSheet2.htm IDH_UpDown1=1009_Trymake - TabSheet2_UpDown1.htm The Map File look like this, it points the varible defined
above to the property: "HelpContext" number which you assign in each
component in the Delphi object inspector : I reccomend that you start your
numbers at the 10000 level and move in fives so that the next one would be
10005. Different sections can jump in hundreds, like 10105. This keeps
everything in sequence and allows the insertion of any later component in
sequence which can be important.
MAP File
#define IDH_Button1 1011
#define IDH_Panel1 1002 #define IDH_CheckListBox1 1001 #define IDH_Button2 1010 #define IDH_STFontsList1 1003 #define IDH_PageControl1 1005 #define IDH_TabSheet1 1006 #define IDH_TabSheet2 1008 #define IDH_UpDown1 1009 ============= You include these two files in the CHM making process (see HHP
below). The consequence is that when the user hits F1 over a control that has a
HelpContext number that is referenced through the two files above, the relevent
help shows in the connected CHM
When making the CHM
The .hhc file that is compiled into the CHM looks like this.
You can make it yourself from a delphi procedure scannin though your Delphi
project snapping pictures (captring controls to JPEG) and even making the HTM
files from the hints and other information in the control.
The stacking of the <UL> tags below causes the book and
chapter effect in the final help file.
================
HHC file:
<!DOCTYPE HTML PUBLIC "-//IETF//DTD
HTML//EN">
<HTML> <HEAD> <meta name="GENERATOR" content="Microsoft® HTML Help Workshop 4.1"> <!-- Sitemap 1.0 --> </HEAD><BODY> <OBJECT type="text/site properties"> <param name="Window Styles" value="0x800025"> </OBJECT> <UL> <LI> <OBJECT type="text/sitemap"> <param name="Name" value="Main List"> <param name="Local" value="1-Frame - 1 - General Informational File Listing.htm"> </OBJECT> <UL> <LI> <OBJECT type="text/sitemap"> <param name="Name" value="Information List"> <param name="Local" value="1 - General Informational File Listing.htm"> </OBJECT> </ul> <LI> <OBJECT type="text/sitemap"> <param name="Name" value="Set Design Features"> <param name="Local" value="1002_Trymake - Trymake_Panel1.htm"> </OBJECT> <ul> <LI> <OBJECT type="text/sitemap"> <param name="Name" value="Numer of Graphics Wanted"> <param name="Local" value="1001_Trymake - Panel1_CheckListBox1.htm"> </OBJECT> <LI> <OBJECT type="text/sitemap"> <param name="Name" value="Choose from the available font names"> <param name="Local" value="1003_Trymake - Trymake_STFontsList1.htm"> </OBJECT> <LI> <OBJECT type="text/sitemap"> <param name="Name" value="Up down choices"> <param name="Local" value="1008_Trymake - PageControl1_TabSheet2.htm"> </OBJECT> <LI> <OBJECT type="text/sitemap"> <param name="Name" value="Set Number of Colours"> <param name="Local" value="1009_Trymake - TabSheet2_UpDown1.htm"> </OBJECT> </ul> <LI> <OBJECT type="text/sitemap"> <param name="Name" value="Choose Your File Name To Work on"> <param name="Local" value="1005_Trymake - Trymake_PageControl1.htm"> </OBJECT> <ul> <LI> <OBJECT type="text/sitemap"> <param name="Name" value="Make Your file choice here."> <param name="Local" value="1006_Trymake - PageControl1_TabSheet1.htm"> </OBJECT> </ul> <LI> <OBJECT type="text/sitemap"> <param name="Name" value="Start Picture Making"> <param name="Local" value="1011_Trymake - Trymake_Button1.htm"> </OBJECT> <ul> </ul> <LI> <OBJECT type="text/sitemap"> <param name="Name" value="Only use this to remake the help files"> <param name="Local" value="1010_Trymake - Trymake_Button2.htm"> </OBJECT> <ul> <LI> <OBJECT type="text/sitemap"> <param name="Name" value="help.css"> <param name="Local" value="help.css"> </OBJECT> <LI> <OBJECT type="text/sitemap"> <param name="Name" value="help.js"> <param name="Local" value="help.js"> </OBJECT> <LI> <OBJECT type="text/sitemap"> <param name="Name" value="1_alias.txt"> <param name="Local" value="1_alias.txt"> </OBJECT> <LI> <OBJECT type="text/sitemap"> <param name="Name" value="1_map.txt"> <param name="Local" value="1_map.txt"> </OBJECT> </UL>
</UL> </BODY></HTML> ========================= The .HHP file is the CHM maker's project file. It is
essentialy in the INI format. Note how the ALIAS and MAP file from above
are added once in the [FILES] list and once in their own sections.
at the bottom. I have found that likewise directly entering SRC="" referenced
file in the [FILES] section can overcome any "no shows" in the CHM if you get
any.
HHP File:
[OPTIONS]
Auto Index=Yes Compatibility=1.1 or later Compiled file=helpMake.chm Contents file=helpMake.hhc Default topic=1002_Trymake - Trymake_Panel1.htm Display compile progress=Yes Enhanced decompilation=Yes Full-text search=Yes Language=0x1409 English (New Zealand) Title=Making Graphics trial Help File [FILES] 1002_Trymake - Trymake_Panel1.htm 1001_Trymake - Panel1_CheckListBox1.htm 1003_Trymake - Trymake_STFontsList1.htm 1008_Trymake - PageControl1_TabSheet2.htm 1009_Trymake - TabSheet2_UpDown1.htm 1005_Trymake - Trymake_PageControl1.htm 1006_Trymake - PageControl1_TabSheet1.htm 1011_Trymake - Trymake_Button1.htm 1010_Trymake - Trymake_Button2.htm help.css help.js 1_alias.txt 1_map.txt helpMake.hhc helpMake.hhp Project.ini [ALIAS]
#include 1_alias.txt [MAP]
#include 1_map.txt [INFOTYPES]
=========
For a new help project .. Procedure for capturing images of
controls, I had to create a seperate form to temporarily copy the control to by
changing its parent, and then snapshot it on a white background (form canvasss).
Set up a hidden (from normal user) or temporary procedure to initaite the
following. Iterate through your project's forms, testing
Twincontrol descendants to see whether their HelpContext is greater
than 0. If so send them to this function. Then also prompt for the Help Text and
create an html document for the Help file ([Tstringlist].saveToFile (
SavePath+inttostr(Control.Helpcontext)+'_'+ Control.Name+'.htm'); include the
image generated in the help document
. Also at the same time auto generate the HHC and the ALIAS and
MAP files. My units for this are a mess that makes sense to me only!
Or I would send them to you. But the procedure is as I have described
it. Here is the JPEG generation code which was the hrdest bit to track down
and rework. I seem to recall that the core of the following is based
in part on Peter Belowes WIN32 API information.
function TCreateJpegPicture.makePictsfromForm(thisForm :Tform;
Control :Twincontrol; savePath : string):boolean;
VAR
bmp : tBitmap; Dc : HDC; R : TRect; HoldParent :twincontrol; Left, Top :integer; JpegMake : tjpegimage; begin
try self.color := clWhite; forcedirectories(savePath); control.Show; holdParent := control.Parent; Left := control.Left; Top := control.Top; control.Parent:= Self;
control.Left := 4; control.Top := 4; Self.Show; showmessage('Processing :'+ control.name); DC := GetDC ( self.handle);
R := Control.boundsRect; bmp := tBitmap.create; bmp.width := (R.Right-R.Left) ; bmp.Height := (R.Bottom - R.Top);
Bitblt(bmp.canvas.handle,0,0,bmp.Width,bmp.height,dc,r.left,r.top,srccopy);
jpegMake := tjpegimage.Create;
jpegMake.Assign(Bmp); jpegMake.CompressionQuality := 100; jpegMake.Compress; //same format as below can be used to generate the individual
help files
jpegMake.saveToFile (
SavePath+inttostr(Control.Helpcontext)+'_'+
Control.Name+'.jpg');
bmp.free; jpegMake.Free; control.Parent := HoldParent;
control.Left := Left; control.Top := Top ; Self.Hide; thisForm.Show; releasedc(thisForm.handle,dc); result := true; except result := false; end; end ;
====================
Paul
Ph NZ 021 782 433
Fx NZ 021 292 2433 Overseas:
Ph. +6421782433
Fax +64212912433 P.O. Box 1005
Nelson 7015 New Zealand |
_______________________________________________ Delphi mailing list [EMAIL PROTECTED] http://ns3.123.co.nz/mailman/listinfo/delphi
