JackBurman
May 16, 2011
- "Submit final LITE version"
EDIT:
This is the final version for the Lite edition of LB Help Search
Version 1.03b for discussion only
changed createBrowseControl from subroutine to called sub
Reason: working towards using handle$ to handle button clicks
Would like comment on whether the calls and the sub are properly formed...
' LB Help Search entry' Author: jaba' Date: May 5, 2011'' History:' v1.0 May 6, 2011 Submitted' v1.01 May 6, 2011 Added browser control' v1.02 May 9, 2011 Added GetModuleFileName$() routine' v1.03 May 12, 2011 Additional pages added to quick viewer' Some names made more purpose-descriptive'' v1.03b May 13, 2011 in progress...using sub to create ATL browser window''' This code is free for personal use.'' 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.'' This is a basic and minimum interface which uses the default browser' to display help file pages.''' Thanks to Stefan Pendl for API function method to obtain location of' LB installation directory. This method is more reliable with systems' running Vista/Win7 than is the StartupDir$ or DefaultDir$ method.
InstallDir$ = GetFolder$(GetModuleFileName$())
HelpDir$ = InstallDir$ +"lb4help\LibertyBASIC_4_web\HTML\"
HelpFileIndex$ = InstallDir$; "lb4help\LibertyBASIC_4.html"'List of Quick View pages:'Quick Start Guide = "libe3mnn.htm"'Command Reference = "libe2co3.htm"'Reserved Word List = "libe6ldg.htm"Open"atl"ForDLLAs#atl
CallDLL#atl,"AtlAxWinInit", Ret AslongnomainwinWindowWidth=442WindowHeight=520UpperLeftX=DisplayWidth-WindowWidthUpperLeftY=40statictext#s.search "Search for: ",10,15,200,20textbox#s.term 10,35,320,25button#s.content "Contents",[openContentsPage], UL,340,5,80,25button#s.default "Find",[findPages], UL,340,35,80,25listbox#s.pages, found$(),[displaySelectedPage],10,65,410,190button#s.quick "Quick Start Guide",[quickButton], UL,100,260,100,25'points to libe3mnn.htmbutton#s.commands "Command Reference",[commandsButton], UL,205,260,115,25'points to libe2co3.htmbutton#s.reserve "Reserved Words",[reservedButton], UL,325,260,95,25'points to libe6ldg.htmstatictext#s.heading "Quick Viewer",10,267,90,20graphicbox#s.resource 10,290,410,170'container for browser controlstatictext#s.status,"Right-click browser window for BACK/FORWARD.",10,468,410,20open"Search Me!"for dialog_nf as#s
#s "trapclose [quit]"#s "font ms_sans_serif 9"#s.content "!font ms_sans_serif 9 bold"#s.search "!font ms_sans_serif 9 bold"#s.heading "!font ms_sans_serif 9 bold"#s.status "!font arial 7"'display Quick Start Guide in browse control
QuickViewPage$ ="libe3mnn.htm"call createBrowseControl HelpDir$, QuickViewPage$, hFlag
#s.term "!setfocus"dim info$(10,10)files HelpDir$,"*.htm", info$()
numFiles =val(info$(0,0))wait[quickButton]
QuickViewPage$ ="libe3mnn.htm"call createBrowseControl HelpDir$, QuickViewPage$, hFlag
wait[commandsButton]
QuickViewPage$ ="libe2co3.htm"call createBrowseControl HelpDir$, QuickViewPage$, hFlag
wait[reservedButton]
QuickViewPage$ ="libe6ldg.htm"call createBrowseControl HelpDir$, QuickViewPage$, hFlag
wait[findPages]#s.term "!contents? term$"dim 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
nextwait[openContentsPage]'open user's default browserrun"rundll32.exe url.dll,FileProtocolHandler "; chr$(34); HelpFileIndex$; chr$(34)#s.term "!setfocus"wait[displaySelectedPage]#s.pages "selection? FileName$"
FileName$ =word$(FileName$,2,chr$(0))'open in user's default browser or new tabrun"rundll32.exe url.dll,FileProtocolHandler "; chr$(34); HelpDir$; FileName$; chr$(34)wait[quit]close#s
close#atl
end'XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX'SUBS 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 Pendl'added 5/9/11function 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$
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 style0Aslong, _ 'left x pos0Aslong, _ 'top y pos408Aslong, _ 'width168Aslong, _ '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 controlendsub
Version 1.03 Additional pages added to quick viewer
' LB Help Search entry' Author: jaba' Date: May 5, 2011'' History:' v1.0 May 6, 2011 Submitted' v1.01 May 6, 2011 Added browser control' v1.02 May 9, 2011 Added GetModuleFileName$() routine' v1.03 May 12, 2011 Additional pages added to quick viewer' Some names made more purpose-descriptive''' This code is free for personal use.'' 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.'' This is a basic and minimum interface which uses the default browser' to display help file pages.''' Thanks to Stefan Pendl for API function method to obtain location of' LB installation directory. This method is more reliable with systems' running Vista/Win7 than is the StartupDir$ or DefaultDir$ method.
InstallDir$ = GetFolder$(GetModuleFileName$())
HelpDir$ = InstallDir$ +"lb4help\LibertyBASIC_4_web\HTML\"
HelpFileIndex$ = InstallDir$; "lb4help\LibertyBASIC_4.html"'List of Quick View pages:'Quick Start Guide = "libe3mnn.htm"'Command Reference = "libe2co3.htm"'Reserved Word List = "libe6ldg.htm"Open"atl"ForDLLAs#atl
CallDLL#atl,"AtlAxWinInit", Ret AslongnomainwinWindowWidth=442WindowHeight=520UpperLeftX=DisplayWidth-WindowWidthUpperLeftY=40statictext#s.search "Search for: ",10,15,200,20textbox#s.term 10,35,320,25button#s.content "Contents",[openContentsPage], UL,340,5,80,25button#s.default "Find",[findPages], UL,340,35,80,25listbox#s.pages, found$(),[displaySelectedPage],10,65,410,190button#s.quick "Quick Start Guide",[quickButton], UL,100,260,100,25'points to libe3mnn.htmbutton#s.commands "Command Reference",[commandsButton], UL,205,260,115,25'points to libe2co3.htmbutton#s.reserve "Reserved Words",[reservedButton], UL,325,260,95,25'points to libe6ldg.htmstatictext#s.heading "Quick Viewer",10,267,90,20graphicbox#s.resource 10,290,410,170'container for browser controlstatictext#s.status,"Right-click browser window for BACK/FORWARD.",10,468,410,20open"Search Me!"for dialog_nf as#s
#s "trapclose [quit]"#s "font ms_sans_serif 9"#s.content "!font ms_sans_serif 9 bold"#s.search "!font ms_sans_serif 9 bold"#s.heading "!font ms_sans_serif 9 bold"#s.status "!font arial 7"'display Quick Start Guide in browse control
QuickViewPage$ ="libe3mnn.htm"gosub[createBrowseControl]#s.term "!setfocus"dim info$(10,10)files HelpDir$,"*.htm", info$()
numFiles =val(info$(0,0))wait[quickButton]
QuickViewPage$ ="libe3mnn.htm"gosub[createBrowseControl]wait[commandsButton]
QuickViewPage$ ="libe2co3.htm"gosub[createBrowseControl]wait[reservedButton]
QuickViewPage$ ="libe6ldg.htm"gosub[createBrowseControl]wait[findPages]#s.term "!contents? term$"dim 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
nextwait[openContentsPage]'open user's default browserrun"rundll32.exe url.dll,FileProtocolHandler "; chr$(34); HelpFileIndex$; chr$(34)#s.term "!setfocus"wait[displaySelectedPage]#s.pages "selection? FileName$"
FileName$ =word$(FileName$,2,chr$(0))'open in user's default browser or new tabrun"rundll32.exe url.dll,FileProtocolHandler "; chr$(34); HelpDir$; FileName$; chr$(34)wait[quit]close#s
close#atl
end'XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX'SUBS 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 Pendl'added 5/9/11function 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 +1endifwendendfunction[createBrowseControl]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$ = HelpDir$ + QuickViewPage$
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 style0Aslong, _ 'left x pos0Aslong, _ 'top y pos408Aslong, _ 'width168Aslong, _ '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 controlreturn
Version 1.02 added GetModuleFileName$() routine
' LB Help Search entry' Author: jaba' Date: May 5, 2011'' History:' v1.0 May 6, 2011 Submitted' v1.01 May 6, 2011 Added browser control' v1.02 May 9, 2011 Added GetModuleFileName$() routine'' This code is free for personal use.'' 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.'' This is a basic and minimum interface which uses the default browser' to display search terms. As I learn more, I may include a browser control' in the interface, which I think is the best and fastest way to display' the search terms. But, for now, I'm happy to be making a submission.'' To display the Reserved Word List, I edited the .htm file and saved it' as a .txt file in my /HTML/ sub folder. The user will see the html' file in the lower textbox, which includes html tags. I have not made a' parser yet, or included the browser control to display html files.' At this point, it's an idea only.'' Thanks to Stefan Pendl for API function method to obtain location of' LB installation directory. This method is more reliable with systems' running Vista/Win7 than is the StartupDir$ or DefaultDir$ method.
InstallDir$ = GetFolder$(GetModuleFileName$())
HelpDir$ = InstallDir$ +"lb4help\LibertyBASIC_4_web\HTML\"
ReservedWordPage$ = HelpDir$ +"libe6ldg.htm"'"libe6ldg.txt"
HelpFileIndex$ = InstallDir$; "lb4help\LibertyBASIC_4.html"nomainwinWindowWidth=442WindowHeight=520UpperLeftX=DisplayWidth-WindowWidthUpperLeftY=40statictext#s.search "Search for: ",10,15,200,20textbox#s.term 10,35,320,25button#s.default "Find",[getIt], UL,340,35,80,25listbox#s.pages, found$(),[ListPages],10,65,410,200statictext#s.heading "Commands and Reserved Word List",10,270,300,20graphicbox#s.reserved 10,290,410,170'container for browser controlbutton#s.content "Contents",[startBrowser], UL,340,5,80,25open"Search Me!"for dialog_nf as#s
#s "trapclose [quit]"#s.content "!font ms_sans_serif 9 bold"#s.search "!font ms_sans_serif 9 bold"#s.heading "!font ms_sans_serif 9 bold"gosub[createBrowseControl]'branch to load browser control and reserved word list#s.term "!setfocus"dim info$(10,10)files HelpDir$,"*.htm", info$()
numFiles =val(info$(0,0))wait[getIt]#s.term "!contents? term$"dim 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
nextwait[ListPages]#s.pages "selection? FileName$"
FileName$ =word$(FileName$,2,chr$(0))run"rundll32.exe url.dll,FileProtocolHandler "; chr$(34); HelpDir$; FileName$; chr$(34)wait[startBrowser]run"rundll32.exe url.dll,FileProtocolHandler "; chr$(34); HelpFileIndex$; chr$(34)#s.term "!setfocus"wait[quit]close#s
close#atl
end'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 Pendl'added 5/9/11function 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 +1endifwendendfunction''The following routine was copied nearly verbatim from the ATL Tutorial at'' http://lbpe.wikispaces.com/ATL+Tutorial by Alyce Watson. I used the first'' three snippets from the demo - ATL DLL, and Creating the control. I'' refered to the entries by Stefan and Alyce to learn what variables needed'' to be changed to fit my program. I was surprised at how well it worked for'' so little investment of my time and energy.[createBrowseControl]
hWndContainer =hWnd(#s.reserved)'graphicbox handleOpen"atl"ForDLLAs#atl
CallDLL#atl,"AtlAxWinInit", Ret AslongcallDLL#user32,"GetWindowLongA", _
hWndContainer asulong, _
_GWL_HINSTANCE aslong, _
hInst asulong
ResName$ = ReservedWordPage$
style = _WS_CHILD or _WS_VISIBLE or _WS_VSCROLL
CallDLL#user32,"CreateWindowExA", _
_WS_EX_STATICEDGE Aslong, _ 'extended type"AtlAxWin"Asptr, _ 'class name
ResName$ Asptr, _ 'URL, or progID or CLSID -file name
style Aslong, _ 'window style0Aslong, _ 'left x pos0Aslong, _ 'top y pos408Aslong, _ 'width168Aslong, _ '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 controlreturn
Version 1.01 added with Browser Control
' LB Help Search entry' Author: jaba' Date: May 5, 2011'' History:' v1.0 May 6, 2011 Submitted' v1.01 May 6, 2011 Added browser control'' This code is free for personal use.'' 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.'' This is a basic and minimum interface which uses the default browser' to display search terms. As I learn more, I may include a browser control' in the interface, which I think is the best and fastest way to display' the search terms. But, for now, I'm happy to be making a submission.'' To display the Reserved Word List, I edited the .htm file and saved it' as a .txt file in my /HTML/ sub folder. The user will see the html' file in the lower textbox, which includes html tags. I have not made a' parser yet, or included the browser control to display html files.' At this point, it's an idea only.'
HelpDir$ =StartupDir$+"lb4help\LibertyBASIC_4_web\HTML\"
ReservedWordPage$ = HelpDir$ +"libe6ldg.htm"'"libe6ldg.txt"
HelpFileIndex$ =StartupDir$; "lb4help\LibertyBASIC_4.html"nomainwinWindowWidth=442WindowHeight=520UpperLeftX=DisplayWidth-WindowWidthUpperLeftY=40statictext#s.search "Search for: ",10,15,200,20textbox#s.term 10,35,320,25button#s.default "Find",[getIt], UL,340,35,80,25listbox#s.pages, found$(),[ListPages],10,65,410,200statictext#s.heading "Commands and Reserved Word List",10,270,300,20'' stylebits #s.reserved, _WS_VSCROLL, _ES_AUTOHSCROLL, 0, 0'' textbox #s.reserved 10, 290, 410, 170graphicbox#s.reserved 10,290,410,170'container for browser controlbutton#s.content "Contents",[startBrowser], UL,340,5,80,25open"Search Me!"for dialog_nf as#s
#s "trapclose [quit]"#s.content "!font ms_sans_serif 9 bold"#s.search "!font ms_sans_serif 9 bold"#s.heading "!font ms_sans_serif 9 bold"'' #s.reserved "!font courier_new 8"gosub[createBrowseControl]'branch to load browser control and reserved word list'' #s.reserved ReservedWordList$(ReservedWordPage$)#s.term "!setfocus"dim info$(10,10)files HelpDir$,"*.htm", info$()
numFiles =val(info$(0,0))wait[getIt]#s.term "!contents? term$"dim 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
nextwait[ListPages]#s.pages "selection? FileName$"
FileName$ =word$(FileName$,2,chr$(0))run"rundll32.exe url.dll,FileProtocolHandler "; chr$(34); HelpDir$; FileName$; chr$(34)wait[startBrowser]run"rundll32.exe url.dll,FileProtocolHandler "; chr$(34); HelpFileIndex$; chr$(34)#s.term "!setfocus"wait[quit]'How can I close browser window programmatically?' notice "Be sure to close browser!"close#s
close#atl
end'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''This function is not needed when using browser controlfunction ReservedWordList$(page$)open page$ forinputas#file
ReservedWordList$ =INPUT$(#file,lof(#file))close#file
endfunction''The following routine was copied nearly verbatim from the ATL Tutorial at'' http://lbpe.wikispaces.com/ATL+Tutorial by Alyce Watson. I used the first'' three snippets from the demo - ATL DLL, and Creating the control. I'' refered to the entries by Stefan and Alyce to learn what variables needed'' to be changed to fit my program. I was surprised at how well it worked for'' so little investment of my time and energy.[createBrowseControl]
hWndContainer =hWnd(#s.reserved)'graphicbox handleOpen"atl"ForDLLAs#atl
CallDLL#atl,"AtlAxWinInit", Ret AslongcallDLL#user32,"GetWindowLongA", _
hWndContainer asulong, _
_GWL_HINSTANCE aslong, _
hInst asulong
ResName$ = ReservedWordPage$
style = _WS_CHILD or _WS_VISIBLE or _WS_VSCROLL
CallDLL#user32,"CreateWindowExA", _
_WS_EX_STATICEDGE Aslong, _ 'extended type"AtlAxWin"Asptr, _ 'class name
ResName$ Asptr, _ 'URL, or progID or CLSID -file name
style Aslong, _ 'window style0Aslong, _ 'left x pos0Aslong, _ 'top y pos408Aslong, _ 'width168Aslong, _ '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 controlreturn
Initial submission Version 1.0
' LB Help Search entry' Author: jaba' Date: May 5, 2011'' History:' v1.0 May 6, 2011 Submitted''' This code is free for personal use.'' 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.'' This is a basic and minimum interface which uses the default browser' to display search terms. As I learn more, I may include a browser control' in the interface, which I think is the best and fastest way to display' the search terms. But, for now, I'm happy to be making a submission.'' To display the Reserved Word List, I edited the .htm file and saved it' as a .txt file in my /HTML/ sub folder. The user will see the html' file in the lower textbox, which includes html tags. I have not made a' parser yet, or included the browser control to display html files.' At this point, it's an idea only.'
HelpDir$ =StartupDir$+"lb4help\LibertyBASIC_4_web\HTML\"
ReservedWordPage$ = HelpDir$ +"libe6ldg.htm"'"libe6ldg.txt"
HelpFileIndex$ =StartupDir$; "lb4help\LibertyBASIC_4.html"nomainwinWindowWidth=442WindowHeight=520UpperLeftX=DisplayWidth-WindowWidthUpperLeftY=40statictext#s.search "Search for: ",10,15,200,20textbox#s.term 10,35,320,25button#s.default "Find",[getIt], UL,340,35,80,25listbox#s.pages, found$(),[ListPages],10,65,410,200statictext#s.heading "Commands and Reserved Word List",10,270,300,20stylebits#s.reserved, _WS_VSCROLL, _ES_AUTOHSCROLL,0,0textbox#s.reserved 10,290,410,170button#s.content "Contents",[startBrowser], UL,340,5,80,25open"Search Me!"for dialog_nf as#s
#s "trapclose [quit]"#s.content "!font ms_sans_serif 9 bold"#s.search "!font ms_sans_serif 9 bold"#s.heading "!font ms_sans_serif 9 bold"#s.reserved "!font courier_new 8"#s.reserved ReservedWordList$(ReservedWordPage$)#s.term "!setfocus"dim info$(10,10)files HelpDir$,"*.htm", info$()
numFiles =val(info$(0,0))wait[getIt]#s.term "!contents? term$"dim 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
nextwait[ListPages]#s.pages "selection? FileName$"
FileName$ =word$(FileName$,2,chr$(0))run"rundll32.exe url.dll,FileProtocolHandler "; chr$(34); HelpDir$; FileName$; chr$(34)wait[startBrowser]run"rundll32.exe url.dll,FileProtocolHandler "; chr$(34); HelpFileIndex$; chr$(34)#s.term "!setfocus"wait[quit]'How can I close browser window programmatically?notice"Be sure to close browser!"close#s
end'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)endfunctionfunction ReservedWordList$(page$)open page$ forinputas#file
ReservedWordList$ =INPUT$(#file,lof(#file))close#file
endfunction
This is the final version for the Lite edition of LB Help Search
Version 1.03b for discussion only
changed createBrowseControl from subroutine to called sub
Reason: working towards using handle$ to handle button clicks
Would like comment on whether the calls and the sub are properly formed...
Version 1.03 Additional pages added to quick viewer
Version 1.02 added GetModuleFileName$() routine
Version 1.01 added with Browser Control
Initial submission Version 1.0