diff --git a/.gitattributes b/.gitattributes index 7dca3d0f6e..1885e0cddd 100644 --- a/.gitattributes +++ b/.gitattributes @@ -5056,6 +5056,8 @@ packages/winunits-base/src/wininet.pp svneol=native#text/plain packages/winunits-base/src/winver.pp svneol=native#text/plain packages/winunits-base/tests/OOHelper.pp svneol=native#text/plain packages/winunits-base/tests/OOTest.pp svneol=native#text/plain +packages/winunits-base/tests/hhex.pp svneol=native#text/pascal +packages/winunits-base/tests/hhex2.pp svneol=native#text/pascal packages/winunits-base/tests/testcom1.pp svneol=native#text/plain packages/winunits-base/tests/testcom2.pp svneol=native#text/plain packages/winunits-base/tests/testver.pp svneol=native#text/plain diff --git a/packages/winunits-base/tests/hhex.pp b/packages/winunits-base/tests/hhex.pp new file mode 100644 index 0000000000..fa4bc8e02b --- /dev/null +++ b/packages/winunits-base/tests/hhex.pp @@ -0,0 +1,43 @@ +Program Hhex; +{ + Small example/test of the html help OCX. + Marco van de Voort (C) 2009 + + Copy ref.chm from the CHM distribution to this dir. +} +{$mode objfpc}{$H+} +uses htmlhelp; + + +var + HelpfileName : AnsiString; + htmltopic : AnsiString; + res : Integer; + +Begin + Helpfilename:='ref.chm'; + htmltopic := 'ref/refli3.html'; + + Writeln('Html example 1'); + Writeln('note: Copy ref.chm from the CHM distribution to this dir'); + + // HH_DISPLAY_INDEX or HH_DISPLAY_SEARCH work too. + Writeln('calling TOC'); + Res:=HtmlHelpA(0,pchar(helpfilename) ,HH_DISPLAY_TOC,0); + Writeln('program now blocked on readln, press enter (in console window) to continue'); + + readln; + writeln('Showing a topic that is probably about dialog.'); + // probably because due to automatic generation filenames and exact contact can drift. + Res:=HtmlHelpA(0,pchar(helpfilename) ,HH_DISPLAY_TOPIC,ptruint(pchar(htmltopic))); + Writeln('program now blocked on readln, press enter (in console window) to continue'); + readln; + Writeln('ready. Note that the windows die automatically on exit of the program'); + +{ + Not demoed yet : HH_HELPCONTEXT. Load on ID, because we have no files that do that yet +} + + +end. + \ No newline at end of file diff --git a/packages/winunits-base/tests/hhex2.pp b/packages/winunits-base/tests/hhex2.pp new file mode 100644 index 0000000000..860f5f6978 --- /dev/null +++ b/packages/winunits-base/tests/hhex2.pp @@ -0,0 +1,46 @@ +Program hhex2; +{ + Small example/test of the html help OCX. + Marco van de Voort (C) 2009 + + Copy rtl.chm from the CHM distribution to this dir. Test keyword/alink search. +} + +Uses HTMLHelp; + +var + keyword : ansistring; + HelpfileName : AnsiString; + htmltopic : AnsiString; + res : Integer; + ah : PHH_AKLINK ; + +Begin + Helpfilename:='rtl.chm'; + keyword:='Sysutils' ; + + New(ah); + fillchar(ah^,sizeof(ah^),#0); + ah.cbstruct:=sizeof(tagHH_AKLINK); + ah.fReserved := FALSE ; + ah.pszKeywords :=pansichar(keyword); + ah.pszUrl := NIL ; + ah.pszMsgText :='Text succes' ; + ah.pszMsgTitle :='Text fail'; + ah.pszWindow := NIL ; + ah.fIndexOnFail:= false; + + + Res:=HtmlHelpA(0,pchar(helpfilename) ,HH_DISPLAY_INDEX,PTRUINT(PAnsiChar(Keyword))); + + // keyword search seems to have same effect. + Res:=HtmlHelpA(0,pchar(helpfilename) ,HH_ALINK_LOOKUP,PTRUINT(AH)); + writeln(ah.pszkeywords); + writeln(ah.pszurl); + writeln(ah.pszmsgtext); + writeln(ah.pszmsgtitle); + writeln(ah.pszwindow); + writeln(res); + + readln; +end.