Build your chm help with vfp & HTML worshop
Microsoft Compiled HTML Help is a Microsoft proprietary online help format, consisting of a collection of HTML pages, an index and other navigation tools. The files are compressed and deployed in a binary format with the extension .CHM, for Compiled HTML. The format is often used for software documentation.Its panned to work with IE installed. It accepts some command lines (as used in the code below).
It was introduced as the successor to Microsoft WinHelp with the release of Windows 98 and is still supported Windows 10. Although the format was designed by Microsoft, it has been successfully reverse-engineered and is now supported in many document viewer applications.
MS HTML Help Workshop is a help authoring tool that allows you to create and manage Microsoft HTML Help projects and their related files. You can use this tool, to further customize your help, such as changing the appearance of the Contents and Search tabs. You can also create an override for your project .hhp file in your project, which allows you to implement the custom HTML Help Viewer window you need. For more information about Microsoft HTML Help and its related files and customization options,see the help for HTML Help Workshop.
HTML Help Project File (.hhp)
The HTML Help project .hhp file identifies all the elements of an HTML Help project. The HTML Help project file contains the information HTML Help Workshop needs to combine the source files, images, index, and table of contents into a single, compiled help .chm file.
The HTML Help project file also defines the appearance and behavior of the HTML Help Viewer window.
You can override the default template.hhp file to adjust the default appearance of your HTML Help, such as the default size and position of the HTML Help Viewer window or the buttons displayed in the toolbar pane. You can also define additional windows in the template.hhp file, such as a window without the navigation pane.
For more information, see “Adjusting the HTML Help Viewer Window Size and Toolbar Buttons” and “Creating an Additional HTML Help Window Definition”.
HTML Help Contents File (.hhc)
The HTML Help contents .hhc file defines the table of contents for the help. This file includes entries for each occurrence of the paragraph styles .
HTML Help displays the contents of this file on the Contents tab of the navigation pane.
HTML Help Index File (.hhk)
The HTML Help index .hhk file defines the index for the help. This file includes entries based on the index markers and field codes in your source documents. HTML Help displays the contents of this file on the Index tab
of the navigation pane.
HTML Help Mapping File (.h)
The HTML Help mapping .h file identifies the mapping information for context-sensitive help links.
This file includes an entry for each Topic Alias marker or field code in your source documents. Application developers build this file with their project and use the defined aliases to display the appropriate topic in the help. This file is linked in the MAP section of the .hhp file, and its entries coordinate with the entries in the ALIAS section of the .hhp file
*html help workshop is a free MS download (install zip+documentation).can be dowloaded from this link if not *installed on system in "%programfiles%\HTML Help Workshop\"
note: %programfiles% folder is the c:\program files
*https://msdn.microsoft.com/en-us/library/windows/desktop/ms669985%28v=vs.85%29.aspx
note an activeX hhctrl.ocx is installed and registered on system.
the hhc.exe provides a manual way to build a complet help project and render a chm compiled file as result.this embeds a quantity of diffrent files.
note: a chm file can be decompiled as well with the html help worshop.
The Microsoft HTML Help output format generates output files that conform to the HTML 4 and XHTML 1.0 standards.
Microsoft HTML Help provides several important benefits:
-have a single, compressed .chm output file to deliver.
-audience can read your content in the standard Windows HTML Help Viewer.
-The HTML Help Viewer provides a powerful search engine that supports partial words, synonym searching, and other advanced search options.
Back to top
-audience cannot read the .chm file over a network or over the Web. The .chm file must be installed on the local computer.(Some security settings can interfere with .chm file use).
It supports many languages.
this a simple code having goal to build a complet chm file.if the table of contents,search for text,favoris are easy to build, the index pane recquiert some complexity.here its a fake index only.must adapt for each specific case.
its built easily from vfp after opening & studying the help workshop files structures.
its a 4 tabs module similar chm help to vfp9 foxHelp.
the search pane traverses all files embed in chm to search any word.all words found are highlighted.in each page can issue CTRL+F to search in(dialog).
The html workshop (chm extension) can be read from any PC with associated application and can be distributed (see installation folder).its opened after click (or dblclick) in explorer..
Can prepare a project help with some [htm,html,images(PNG,JPG,Gif),prg,mpr,txt,h,pdf] in a special folder and run the code below.
can modify interactively by hhc.exe (installation) .Dont forget to recompile for each modification.
the index (.hhk) can be modified as your goal or missed(dont appear if you comment the line: '=yhhk()').
this is basics, can go advanced options and more complexity with html help workshop.
with the prg below can build a proj, add a config.fpw and comple to an exe.
can read :https://msdn.microsoft.com/en-us/library/windows/desktop/ms670169%28v=vs.85%29.aspx
note:if have a big project timeout (90sec) can return error.no problem click and wait code finishing.chm even build fine.
*See the update of code*1* in code *2*
Click on code to select [then copy] -click outside to deselect
*1*
*the code downloads itself the 4th and 5th images below used in code.(saved as 'carta_creme.gif' and' fox.png' in source folder)
*if not installed on disc,html help workshop free download (install zip+documentation):
*https://msdn.microsoft.com/en-us/library/windows/desktop/ms669985%28v=vs.85%29.aspx
*to see the result,try this code first with a big images folder...
*added files extension : prg,mpr,h,txt but converted to html files to be accepted.(erase html files created if not needed)
*added file extension PDF but it opens with associated app (not directly in chm).
Set Safe Off
Set Exact On
Declare Integer Sleep In kernel32 Integer
Declare Integer ShellExecute In SHELL32.Dll Integer nWinHandle,;
STRING cOperation,;
STRING cFileName,;
STRING cParameters,;
STRING cDirectory,;
INTEGER nShowWindow
Declare Integer URLDownloadToFile In urlmon.Dll Integer pCaller, String szURL, String szFileName, Integer dwReserved, Integer lpfnCB
Declare Integer DeleteUrlCacheEntry In wininet String lpszUrlName
*added test if hhc.exe present in assumed location
if !file(getenv('programfiles')+"\HTML HELP WORKSHOP\HHC.EXE")
messagebox(getenv('programfiles')+"\HTML HELP WORKSHOP\HHC.EXE"+" not found.Please verify if html workShop installed or change location in code if installed out !",16+4096,'Error')
return .f.
endi
Publi m.yrep0,m.xdir
m.yrep=Addbs(Justpath(Sys(16,1)))
If !Directory(m.yrep+"ychm")
Md m.yrep+"ychm"
Endi
m.yrep0=Addbs(m.yrep+"ychm")
Set Defa To (m.yrep0)
Local m.xclean
m.xclean=Lower(Inputbox("Clean final folder results (yes-no)?","","yes"))
If !Inlist(m.xclean,'yes','no')
m.xclean="yes"
Endi
*download 2 photos used in code
Local lcDownloadUrl,lcDownloadLoc
For i=1 To 2
Do Case
Case i=1
lcDownloadUrl = "http://img.over-blog-kiwi.com/1/43/54/07/20160316/ob_da7c2a_carta-creme.gif"
lcDownloadLoc =m.yrep0+"carta_creme.gif"
Case i=2
lcDownloadUrl = "http://img.over-blog-kiwi.com/1/43/54/07/20160316/ob_6147b9_fox.png"
lcDownloadLoc =m.yrep0+"fox.png"
Endcase
lnResult = DeleteUrlCacheEntry(lcDownloadUrl)
lnResult = URLDownloadToFile(0, lcDownloadUrl, lcDownloadLoc , 0,0)
If lnResult = 0
Wait Window "Download "+lcDownloadLoc +" Complete" Nowait
*Else
*!* Messagebox("Download fails")
Endi
Endfor
m.xdir=Getdir()
m.xdir=Addbs(m.xdir)
If File(m.yrep0+"ymain.html")
Dele File (m.yrep0+"ymain.html")
Endi
If File(m.yrep0+"ychm.chm")
Erase (m.yrep0+"ychm.chm")
Endi
Local m.gnbre
m.gnbre=Adir(gabase,m.xdir+"*.*")
Create Cursor ycurs (yfile c(150))
For i=1 To m.gnbre
If Inlist(Lower(Justext(gabase(i,1))),'html','htm','jpg','png','gif','prg','mpr','txt','h','pdf')
Insert Into ycurs Values ( m.xdir+Allt(gabase(i,1)))
Endi
Endfor
*********
=yconvert2html() &&if prg,mpr,txt;h files converted to html to be supported
*brow
=yhhk() &&can comment this line if not want index tab
=yhhc()
*********
Local m.xx,m.uu,m.xtitle,m.yy,m.myvar
Sele ycurs
m.xx=""
m.uu="<br><br><br>"
Scan
i=Recno()
m.xx=m.xx+yfile+Chr(13)
m.uu=m.uu+Trans(i)+". "+[<a href="mk:@MSITStore:]+m.yrep0+"ychm.chm"+[::/]+Justfname(yfile)+[ "> ]+juststem(yfile)+[ </a><br>]+Chr(13)
Endscan
m.xtitle=inputbox("Put a title of chm here ","","My chm files summary")
TEXT to m.yy textmerge noshow
<body bgcolor=cyan background="carta_creme.gif">
<img src="fox.png" style="float:right;width:80px;height:80px;cursor:pointer;" onclick='alert("Author:Yousfi Benameur 14 march 2016");'>
<center>
<h2 style="width:600px;color:white;background-color:navy;"> <<m.xtitle>> </h2></center>
<<m.uu>>
</body>
ENDTEXT
Strtofile(m.yy,m.yrep0+"ymain.html")
m.xx=m.yrep0+"ymain.html"+Chr(13)+m.xx && first main index file
TEXT to m.myvar textmerge noshow
[OPTIONS]
Flat=No
Auto Index=Yes
Compatibility=1.1 or later
Compiled file=<<m.yrep0+"ychm.chm">>
Contents File=<<m.yrep0+"ychm.hhc">>
Default Window=main
Default Topic=<<m.yrep0+"ymain.html">>
Index File=<<m.yrep0+"ychm.hhk">>
Display compile progress=no
Full-text search=Yes
Language=0x409 English (US)
Title=<<m.xtitle>>
Binary TOC=no
Binary Index=No
Default Font=Courier New,8,0
Create CHI file=No
Full text search stop list file=
Display compile notes=yes
[FILES]
<<m.xx>>
[WINDOWS]
main="Online Help","ychm.hhc","ychm.hhk","ymain.html","ymain.html",,,,,0x23520,275,0x1046,[317,243,947,683],0xB0000,,,,,,0
wndTopic="New Topic Window","ychm.hhc","ychm.hhk","ymain.html","ymain.html",,,,,0x23520,122,0x1046,[669,7,1017,728],0xB0000,,,1,,,0
[MERGE FILES]
[MAP] [ALIAS]
[INFOTYPES]
ENDTEXT
Strtofile(m.myvar,m.yrep0+"yfiles.hhp")
Sleep(1000)
Set Defa To (m.yrep0)
TEXT to m.myvar textmerge noshow
"%programfiles%\HTML Help Workshop\hhc" <<m.yrep0+"yfiles.hhp">> > <<m.yrep0+"log.txt">>
ENDTEXT
Strtofile(m.myvar,m.yrep0+"ybat.bat")
Local oshell
oshell=Newobject("wscript.shell")
oshell.Run(m.yrep0+"ybat.bat",.T.,0)
&&shellexecute
Local t0,result
Try
t0=Seconds()
Do While Seconds()-t0<=90 &&1.5 mn...is an average-- to adapt (depends on chm size)
If Mod(Int(Seconds()-t0),30)=0
Wait Window Trans(Int(Seconds()-t0))+"/90" Nowait
Endi
Enddo
If !File(m.yrep0+"ychm.chm")
Return .F.
Endi
result = ShellExecute(0, "open", m.yrep0+"ychm.chm","","",1)
Catch
Endtry
If m.xclean="yes"
Try
Set Defa To (m.yrep0)
Dele File carta_creme.gif
Dele File fox.png
Dele File Log.txt
Dele File ybat.bat
Dele File ychm.hhc
Dele File ychm.hhk
Dele File yfiles.hhp
Dele File ymain.html
Catch
Endtry
Endi
Return
*end of main prg
*Language=0x40c Français (standard)
*build hhc file (contents)
Function yhhc()
Sele ycurs
Local m.xx, m.myvar
m.xx=""
Scan
TEXT to m.myvar textmerge noshow
<LI><OBJECT type="text/sitemap">
<param name="Name" value="<<juststem(allt(yfile))>>" >
<param name="Local" value="<<justfname(yfile)>>">
<param name="Local" value="mk:@MSITStore:ychm.chm::/<<justfname(yfile)>>">
</OBJECT>
ENDTEXT
m.xx=m.xx+m.myvar+Chr(13)
Endscan
m.xx=m.xx+Chr(13)
TEXT to m.myvar textmerge noshow
<!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">
<param name="comment" value="title:Online Help">
<param name="comment" value="base:ymain.html">
</OBJECT>
<UL>
<LI><OBJECT type="text/sitemap">
<param name="Name" value="Welcome">
<param name="Local" value="ymain.html">
</OBJECT>
<LI><OBJECT type="text/sitemap">
<param name="Name" value="Help Contents summary">
</OBJECT>
<UL>
<<m.xx>>
</UL>
</BODY>
</HTML>
ENDTEXT
Strtofile(m.myvar,m.yrep0+"ychm.hhc")
Endfunc
*build hhk file (index of keywords with links to page to display)
Function yhhk()
Sele ycurs
uu=""
Scan
TEXT to my textmerge noshow
<li><object type="text/sitemap">
<param name="Name" value="<<juststem(yfile)+" - "+trans(10000+recno())>>">
<param name="Name" value="Context sensitive help topic <<trans(10000+recno())>>">
<param name="Local" value="<<justfname(yfile)>>">
</object>
</li>
ENDTEXT
m.uu=m.uu+m.my+Chr(13)
Endscan
Local m.myvar
TEXT to m.myvar textmerge noshow
<html>
<head>
<meta name="generator" content="Help Information® Keyword Index Tool (KIT) 0.6.1">
<!-- Sitemap 1.0 -->
<!-- (c) Help-Info -->
<!-- 2006-11-04 Working with second INDEX file, HHP [OPTIONS] set: Binary Index=Yes -->
</head>
<body>
<object type="text/site properties">
<param name="FrameName" value="right">
<param name="Font" value="Verdana,8,0">
</object>
<ul>
<<m.uu>>
</ul>
</body>
</html>
ENDTEXT
Strtofile(m.myvar,m.yrep0+"ychm.hhk")
Endfunc
Function yconvert2html()
Sele ycurs
Scan
If Inlist(Lower(Justext(yfile)),"prg","mpr","txt","h")
m.vv="<pre><code>"+Filetostr(yfile)+"</code></pre>"
Local m.lcdest
m.lcdest=Addbs(Justpath(yfile))+Juststem(yfile)+".html"
Strtofile(m.vv,m.lcdest)
Repl yfile With m.lcdest
Endi
Endscan
Endfunc
the left help shows 4 tabs in left pane (summary, index,search and favoris)-Can modify interactively by dblclick on any item.The 2 last images are downloaded for using in code above.
Click on code to select [then copy] -click outside to deselect
some limitations encountered with html help workshop:
1-The Microsoft HTML Help compiler has some unstated requirements for path name sizes.
Moving the project to a directory closer to the root drive
(i.e. "d:\help\") and renaming folders inside the project to smaller name reduced the path name size enough so that the project would compile.
2-after run the code above ,you can click on the chm file cannot open it.....receive a message ("cannot open..).the compiler is yet busy if files are numerous.
wait compiling is complete and re try.all is ok here.
3-for html using resources in a folder these resources are not compiled and not appear in chm product.making links as absolute paths they are compiled as well.
Click on code to select [then copy] -click outside to deselect
*2*This is an upadte of the first code above.added possibiity to make order in the files appearing in the helpworkshopw summary panel.
*the code downloads itself the 4th and 5th images below used in code.(saved as 'carta_creme.gif' and' fox.png' in source folder)
*if not installed on disc,html help workshop free download (install zip+documentation):
*https://msdn.microsoft.com/en-us/library/windows/desktop/ms669985%28v=vs.85%29.aspx
*to see the result,try this code first with a big images folder...
*added files extension : prg,mpr,h,txt but converted to html files to be accepted.(erase html files created if not needed)
*added file extension PDF but it opens with associated app (not directly in chm).
*build a project add a config.fpw and build executable (33 ko)
*update sunday 10 april 2016; 19:13:46
if !_vfp.startmode=0
on shutdown quit
endi
_screen.visible=.t.
Local oform
oform=Newobject("yorder")
oform.Show(1)
_screen.visible=.f.
*********
=yconvert2html() &&if prg,mpr,txt;h files converted to html to be supported
*brow
=yhhk() &&can comment this line if not want index tab
=yhhc()
*********
Local m.xx,m.uu,m.xtitle,m.yy,m.myvar
Sele ycurs
m.xx=""
m.uu="<br><br><br>"
Scan
i=Recno()
m.xx=m.xx+yfile+Chr(13)
m.uu=m.uu+Trans(i)+". "+[<a href="mk:@MSITStore:]+m.yrep0+"ychm.chm"+[::/]+Justfname(yfile)+[ "> ]+juststem(yfile)+[ </a><br>]+Chr(13)
Endscan
m.xtitle=inputbox("Put a title of chm here ","","Libharu hpdf library")
TEXT to m.yy textmerge noshow
<body bgcolor=cyan background="carta_creme.gif" >
<img src="fox.png" style="float:right;width:80px;height:80px;cursor:pointer;" onclick='alert("Author:Yousfi Benameur 14 march 2016");'>
<center>
<h2 style="width:600px;color:white;background-color:navy;"> <<m.xtitle>> </h2></center>
<<m.uu>>
</body>
ENDTEXT
Strtofile(m.yy,m.yrep0+"ymain.html")
m.xx=m.yrep0+"ymain.html"+Chr(13)+m.xx && first main index file
TEXT to m.myvar textmerge noshow
[OPTIONS]
Flat=No
Auto Index=Yes
Compatibility=1.1 or later
Compiled file=<<m.yrep0+"ychm.chm">>
Contents File=<<m.yrep0+"ychm.hhc">>
Default Window=main
Default Topic=<<m.yrep0+"ymain.html">>
Index File=<<m.yrep0+"ychm.hhk">>
Display compile progress=no
Full-text search=Yes
Language=0x409 English (US)
Title=<<m.xtitle>>
Binary TOC=no
Binary Index=No
Default Font=Courier New,8,0
Create CHI file=No
Full text search stop list file=
Display compile notes=yes
[FILES]
<<m.xx>>
[WINDOWS]
main="Online Help","ychm.hhc","ychm.hhk","ymain.html","ymain.html",,,,,0x23520,275,0x1046,[317,243,947,683],0xB0000,,,,,,0
wndTopic="New Topic Window","ychm.hhc","ychm.hhk","ymain.html","ymain.html",,,,,0x23520,122,0x1046,[669,7,1017,728],0xB0000,,,1,,,0
[MERGE FILES]
[MAP] [ALIAS]
[INFOTYPES]
ENDTEXT
Strtofile(m.myvar,m.yrep0+"yfiles.hhp")
Sleep(1000)
Set Defa To (m.yrep0)
TEXT to m.myvar textmerge noshow
"%programfiles%\HTML Help Workshop\hhc" <<m.yrep0+"yfiles.hhp">> > <<m.yrep0+"log.txt">>
ENDTEXT
Strtofile(m.myvar,m.yrep0+"ybat.bat")
Local oshell
oshell=Newobject("wscript.shell")
oshell.Run(m.yrep0+"ybat.bat",.T.,0)
&&shellexecute
Local t0,result
Try
t0=Seconds()
Do While Seconds()-t0<=90 &&1.5 mn...is an average-- to adapt (depends on chm size)
If Mod(Int(Seconds()-t0),30)=0
Wait Window Trans(Int(Seconds()-t0))+"/90" Nowait
Endi
Enddo
If !File(m.yrep0+"ychm.chm")
Return .F.
Endi
result = ShellExecute(0, "open", m.yrep0+"ychm.chm","","",1)
Catch
Endtry
If _Screen.xclean="yes"
Try
Set Defa To (m.yrep0)
Dele File carta_creme.gif recycle &&deletd file is in the recycle bin
Dele File fox.png recycle
Dele File Log.txt recycle
Dele File ybat.bat recycle
Dele File ychm.hhc recycle
Dele File ychm.hhk recycle
Dele File yfiles.hhp recycle
Dele File ymain.html recycle
Catch
Endtry
Endi
if !_vfp.startmode=0
quit
else
return
endi
*end of main prg
*Language=0x40c Français (standard)
*build hhc file (contents)
Function yhhc()
Sele ycurs
Local m.xx, m.myvar
m.xx=""
Scan
TEXT to m.myvar textmerge noshow
<LI><OBJECT type="text/sitemap">
<param name="Name" value="<<juststem(allt(yfile))>>" >
<param name="Local" value="<<justfname(yfile)>>">
<param name="Local" value="mk:@MSITStore:ychm.chm::/<<justfname(yfile)>>">
</OBJECT>
ENDTEXT
m.xx=m.xx+m.myvar+Chr(13)
Endscan
m.xx=m.xx+Chr(13)
TEXT to m.myvar textmerge noshow
<!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">
<param name="comment" value="title:Online Help">
<param name="comment" value="base:ymain.html">
</OBJECT>
<UL>
<LI><OBJECT type="text/sitemap">
<param name="Name" value="Welcome">
<param name="Local" value="ymain.html">
</OBJECT>
<LI><OBJECT type="text/sitemap">
<param name="Name" value="Help Contents summary">
</OBJECT>
<UL>
<<m.xx>>
</UL>
</BODY>
</HTML>
ENDTEXT
Strtofile(m.myvar,m.yrep0+"ychm.hhc")
Endfunc
*build hhk file (index of keywords with links to page to dispaly)
Function yhhk()
Sele ycurs
uu=""
Scan
TEXT to my textmerge noshow
<li><object type="text/sitemap">
<param name="Name" value="<<juststem(yfile)+" - "+trans(10000+recno())>>">
<param name="Name" value="Context sensitive help topic <<trans(10000+recno())>>">
<param name="Local" value="<<justfname(yfile)>>">
</object>
</li>
ENDTEXT
m.uu=m.uu+m.my+Chr(13)
Endscan
Local m.myvar
TEXT to m.myvar textmerge noshow
<html>
<head>
<meta name="generator" content="Help Information® Keyword Index Tool (KIT) 0.6.1">
<!-- Sitemap 1.0 -->
<!-- (c) Help-Info -->
<!-- 2006-11-04 Working with second INDEX file, HHP [OPTIONS] set: Binary Index=Yes -->
</head>
<body>
<object type="text/site properties">
<param name="FrameName" value="right">
<param name="Font" value="Verdana,8,0">
</object>
<ul>
<<m.uu>>
</ul>
</body>
</html>
ENDTEXT
Strtofile(m.myvar,m.yrep0+"ychm.hhk")
Endfunc
Function yconvert2html()
Sele ycurs
Scan
If Inlist(Lower(Justext(yfile)),"prg","mpr","txt","h")
m.vv="<pre><code>"+Filetostr(yfile)+"</code></pre>"
Local m.lcdest
m.lcdest=Addbs(Justpath(yfile))+Juststem(yfile)+".html"
Strtofile(m.vv,m.lcdest)
Repl yfile With m.lcdest
Endi
Endscan
Endfunc
Define Class yorder As Form
Top = 0
Left = 0
Height = 402
Width = 669
AutoCenter=.T.
Desktop=.T.
Caption = "Use moverbar to Order the files to appear on the help workshop summary panel"
WindowType = 1
Name = "Form1"
Add Object list1 As ListBox With ;
Anchor = 15, ;
Height = 373, ;
Left = 12, ;
MoverBars = .T., ;
Top = 12, ;
Width = 649, ;
Name = "List1"
Procedure Init
Set Safe Off
Set Exact On
Declare Integer Sleep In kernel32 Integer
Declare Integer ShellExecute In SHELL32.Dll Integer nWinHandle,;
STRING cOperation,;
STRING cFileName,;
STRING cParameters,;
STRING cDirectory,;
INTEGER nShowWindow
Declare Integer URLDownloadToFile In urlmon.Dll Integer pCaller, String szURL, String szFileName, Integer dwReserved, Integer lpfnCB
Declare Integer DeleteUrlCacheEntry In wininet String lpszUrlName
With Thisform.list1
.SelectedItemBackColor=Rgb(70,60,50)
.SelectedItemForeColor=Rgb(10,191,160)
.SpecialEffect=1
.FontSize=8
.ItemBackColor=Rgb(40,40,40)
.ItemForeColor=Rgb(255,204,153)
.BorderColor=Rgb(235,132,0)
.ItemTips=.T.
.MousePointer=15
.ListIndex=1
Endwith
Publi m.yrep0,m.xdir
m.yrep=Addbs(Justpath(Sys(16,1)))
If !Directory(m.yrep+"ychm")
Md m.yrep+"ychm"
Endi
m.yrep0=Addbs(m.yrep+"ychm")
Set Defa To (m.yrep0)
*download 2 photos used in code
Local lcDownloadUrl,lcDownloadLoc
For i=1 To 2
Do Case
Case i=1
lcDownloadUrl = "http://img.over-blog-kiwi.com/1/43/54/07/20160316/ob_da7c2a_carta-creme.gif"
lcDownloadLoc =m.yrep0+"carta_creme.gif"
Case i=2
lcDownloadUrl = "http://img.over-blog-kiwi.com/1/43/54/07/20160316/ob_6147b9_fox.png"
lcDownloadLoc =m.yrep0+"fox.png"
Endcase
lnResult = DeleteUrlCacheEntry(lcDownloadUrl)
lnResult = URLDownloadToFile(0, lcDownloadUrl, lcDownloadLoc , 0,0)
If lnResult = 0
Wait Window "Download "+lcDownloadLoc +" Complete" Nowait
*Else
*!* Messagebox("Download fails")
Endi
Endfor
With _Screen
.AddProperty("xclean","yes")
.xclean=Lower(Inputbox("Clean final folder results (yes-no)?","","yes"))
If !Inlist(.xclean,'yes','no')
.xclean="yes"
Endi
Endwith
m.xdir=Getdir()
m.xdir=Addbs(m.xdir)
If File(m.yrep0+"ymain.html")
Dele File (m.yrep0+"ymain.html")
Endi
If File(m.yrep0+"ychm.chm")
Erase (m.yrep0+"ychm.chm")
Endi
Local m.gnbre
m.gnbre=Adir(gabase,m.xdir+"*.*")
Create Cursor ycurs (yfile c(150))
For i=1 To m.gnbre
If Inlist(Lower(Justext(gabase(i,1))),'html','htm','jpg','png','gif','prg','mpr','txt','h','pdf')
Insert Into ycurs Values ( m.xdir+Allt(gabase(i,1)))
Endi
Endfor
With This.list1
Scan
.AddItem(Allt(yfile))
Endscan
Endwith
Endproc
Procedure Destroy
Sele ycurs
Zap
For i=1 To This.list1.ListCount
Insert Into ycurs Values (This.list1.List(i))
Endfor
*sele ycurs
*brow
Endproc
Enddefine
*
*-- EndDefine: yorder
this code gives to the user to make order of compiled files as they appear visually in html help workshop summary panel
Important:All Codes above are tested on VFP9SP2 & windows 10 pro & IE11 emulation. in general,to avoid some problems with priveleges level, run vfp9.exe as administrator.
Please come back with any bug.correct code is usefull to all readers. With the pleasure to share.