This is a basic search program that adds a search bar to the top of the HTML HELP window. Enter your search term, hit Find button, and select from results in the dropdown combobox list. The HTML contents window is always available. All selections are viewed in the included browser. There is no link to your default browser. There is no Index window.
This is a bare-bones approach.
' LB HTML Simple Search' Author: jaba (JackBurman)' Date: May 27, 2011'' History:' v1.0 May 27, 2011 Submitted Simple Search'' This code is free for personal use.' To protect the rights of others whose code is included, please note following:' You may not republish this code in its current form.' You may modify this code for your personal use.' You may publish a modified version of this code under these conditions:' 1. You have made major changes to the code.' 2. You give credit to the original authors'' Based on a framework provided by Alyce on LB forum.'' Some parts taken from entries by others, including' Alyce, Janet, Stefan, and Gordon.'' Thanks to them and others.'*** BEGIN PROGRAM ***
InstallDir$ = GetFolder$(GetModuleFileName$())
HelpDir$ = InstallDir$ +"lb4help\LibertyBASIC_4_web\HTML\"
HelpFileIndex$ = InstallDir$; "lb4help\"
ContentsFileName$ ="LibertyBASIC_4.html"
WdoTitle$ ="LB HTML SIMPLE SEARCH"global wContainer, hContainer
Open"atl"ForDLLAs#atl
CallDLL#atl,"AtlAxWinInit", Ret Aslongnomainwin[setupGUIWdo]WindowWidth=800WindowHeight= DisplayHeight-60'735UpperLeftX=DisplayWidth-WindowWidthUpperLeftY=2statictext#s.st1,"Search for:",10,5,100,18stylebits#s.default, _BS_DEFPUSHBUTTON,0,0,0button#s.default "Find",[findPages], UL,265,21,80,25button#s.toc "Table of Contents",[tocButton], UL,350,21,115,25combobox#s.pages, found$(),[displaySelectedPage],10,23,250,150'hidden index windowlistbox#s.index, index$(),[pickBox],1610,185,172,320graphicbox#s.resource 0,50,784,625'container for browser control
wContainer =780
hContainer =625[openGUIWdo]open WdoTitle$ forwindowas#s
#s "trapclose [quit]"#s.st1 "!font sans_serif 9 bold"#s "resizehandler [resized]"'display table of contents in browse control
QuickViewPage$ ="libe3mnn.htm"call createBrowseControl HelpFileIndex$, ContentsFileName$, hFlag
dim info$(10,10)files HelpDir$,"*.htm", info$()
numFiles =val(info$(0,0))'load index arraydim index$(numFiles)scanfor i =1to numFiles
open HelpDir$ + info$(i,0)forinputas#file
txt$ =INPUT$(#file,lof(#file))
index$(i)= GetTitle$(txt$); chr$(0); info$(i,0)close#file
next i
sort index$(),1, numFiles
#s.index "reload"#s.pages "setfocus"wait[resized]
wWid =WindowWidth
wHig =WindowHeight#s.resource "locate 0 50 "; wWid-16;" "; wHig-80
wContainer = wWid -20
hContainer = wHig-80calldll#user32,"MoveWindow",_
hFlag Asulong,_
0Aslong,_
0Aslong,_
wContainer Aslong,_
hContainer Aslong,_
1Aslong,_
result Asvoid#s "refresh"wait[tocButton]
QuickViewPage$ ="libe3mnn.htm"call createBrowseControl HelpFileIndex$, ContentsFileName$, hFlag
wait[findPages]#s.pages "contents? term$"if term$ =""thenredim found$(1)#s.pages "reload"waitendifdim found$(numFiles)for i =1to numFiles
open HelpDir$ + info$(i,0)forinputas#file
txt$ =INPUT$(#file,lof(#file))ifinstr(txt$, term$)>0then
found$(i)= GetTitle$(txt$); chr$(0); info$(i,0)#s.pages "reload"endifclose#file
next#s.pages "selectionindex? index"'set index to 0. Seems to be necessary'to enable selecting first item in'combobox list to display in browser.wait[displaySelectedPage]#s.pages "selection? FileName$"
FileName$ =word$(FileName$,2,chr$(0))call createBrowseControl HelpDir$, FileName$, hFlag
wait[pickbox]wait[quit]close#s
close#atl
end'XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXSUBS AND FUNCTIONS'credit: Alyce's entry.'extract title from html textfunction GetTitle$(s$)
marker1=instr(upper$(s$),"<A NAME=")
marker1=instr(upper$(s$),"<B>",marker1)+3
marker2=instr(upper$(s$),"</B>", marker1)
lenTitle=marker2-marker1
GetTitle$=mid$(s$,marker1,lenTitle)endfunction'borrowed from Stefan Pendlfunction GetModuleFileName$()
nSize = _MAX_PATH +1
lpFilename$ =space$(nSize); CHR$(0)calldll#kernel32,"GetModuleFileNameA",_
hModule asuLong,_
lpFilename$ asptr,_
nSize asuLong,_
result asuLongif result >0then GetModuleFileName$ =trim$(lpFilename$)endfunctionfunction GetFolder$(Path$)
pos =1
GetFolder$ = Path$
while pos >0
pos =instr(Path$,"\", pos)if pos >0then
GetFolder$ =left$(Path$, pos)
pos = pos +1endifwendendfunctionsub createBrowseControl D$, F$,byref hATL
if hATL thenCallDLL#user32,"DestroyWindow", _
hATL Asulong, _
result Aslong
hATL =0endif
hWndContainer =hWnd(#s.resource)'graphicbox handlecallDLL#user32,"GetWindowLongA", _
hWndContainer asulong, _
_GWL_HINSTANCE aslong, _
hInst asulong
ResName$ = D$ + F$ 'file to display
cw = wContainer-3
ch = hContainer
style = _WS_CHILD or _WS_VISIBLE or _WS_VSCROLL
CallDLL#user32,"CreateWindowExA", _
_WS_EX_STATICEDGE Aslong, _ 'extended type"AtlAxWin"Asptr, _ 'class name
ResName$ Asptr, _ 'resource file name & path
style Aslong, _ 'window style1Aslong, _ 'left x pos1Aslong, _ 'top y pos
cw Aslong, _ 'width
ch Aslong, _ 'height
hWndContainer Asulong, _ 'handle of container100Aslong, _ 'handle to menu or child window ID
hInst Asulong, _ 'parent instance handle0Aslong, _ 'window creation data
hATL Asulong'handle of active template library controlendsubfunction fileExists(path$, filename$)files path$, filename$, info$()
fileExists =val(info$(0,0))endfunction
This is a bare-bones approach.