Older Version
Newer Version
JanetTerra
May 3, 2011
My submission
' LB Help File Searcher
' Janet Terra
' May 1, 2011
'
' This code is free for personal use.
' 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
'
' Credit for this program goes to members of the Liberty BASIC
' community, most especially Alyce Watson and Stefan Pendl.
' Snippets absorbed and regurgitated by Janet Terra
' Note re: page navigators (previous and next)
' Only pages selected by the listbox are stored
' The navigation buttons have no effect on redisplaying
' pages hyperlinked to within the html pages themselves
'
' Get the path to the Html Help Files and Images - Thanks to Stefan Pendl
LBModulePath$ = GetModuleFileName$() ' Path to liberty44.exe
LBHelpPath$ = GetLBPath$(LBModulePath$);"lb4help\LibertyBASIC_4_web\html\" ' Path to Html Help Files
LBHelpIndex$ = LBHelpPath$;"libe3mnn.htm" ' The LB Index file
LBBmpPath$ = GetLBPath$(LBModulePath$);"bmp\"bttnSearch$ = LBBmpPath$;"SEARCH.BMP"
' Fill an array with command references
dim cmd$(8)
cmd$(1) = "Commands A - C";chr$(0);LBHelpPath$;"LIBE2CO3.HTM"
cmd$(2) = "Commands D - F";chr$(0);LBHelpPath$;"LIBE2M5I.HTM"
cmd$(3) = "Commands G - K";chr$(0);LBHelpPath$;"LIBE2VMZ.HTM"
cmd$(4) = "Commands L - M";chr$(0);LBHelpPath$;"LIBE3BFX.HTM"
cmd$(5) = "Commands N - P";chr$(0);LBHelpPath$;"LIBE3HRK.HTM"
cmd$(6) = "Commands R - S";chr$(0);LBHelpPath$;"LIBE3UER.HTM"
cmd$(7) = "Commands T - Z";chr$(0);LBHelpPath$;"LIBE40QF.HTM"
cmd$(8) = "Index";chr$(0);LBHelpPath$;"libe3mnn.HTM"
' Define a struct to hold window dimensions - Thanks to Bill Beasley
struct rcClient, _
xLeft as long, _
yUpper as long, _
xRight as long, _
yLower as long
' Define a string to hold the viewed pages
pageIndex$ = ""
viewPage = 1
bttnPrev$ = LBBmpPath$;"LBTTN.BMP"bttnNext$ = LBBmpPath$;"RBTTN.BMP"
' The GUI
WindowWidth = 800
WindowHeight = 600
UpperLeftX = int((DisplayWidth - WindowWidth) / 2)
UpperLeftY = int((DisplayHeight - WindowHeight) / 2)
stylebits #main.cmd, 0, _WS_BORDER, 0, 0
graphicbox #main.cmd, 590, 40, 180, 100
bmpbuttonstylebits #main.prev,bttnPrev$,_BS_BITMAP or _WS_THICKFRAME, 0, 0, 0
button #main.prev, "", [prevPage], UL, 650,144bmpbutton144, 32, 32
stylebits #main.next,bttnNext$,_BS_BITMAP or _WS_THICKFRAME, 0, 0, 0
button #main.next, "", [nextPage], UL, 690,144144, 32, 32
textbox #main.srch, 600, 180, 150, 30
stylebits #main.go, _BS_DEFPUSHBUTTON or_BS_BITMAP,_BS_BITMAP or _WS_THICKFRAME, 0, 0, 0
button #main.go, "", [search], UL, 750, 180, 30, 30
listbox #main.mtch, matchFiles$(), [DisplayHtml], 600, 220, 180, 330
graphicbox #main.atl, 20, 20, 565, 530
open "Search LB Help HTML Files" for window_nf as #main
'LoadDraw and save the prev buttonimagesloadbmp "bttnPrev", bttnPrev$image
#main.atl "down"
restore [dataNavImage]
for y = 1 to 30
for x = 1 to 30
read pixelLong
r = GetRed(pixelLong)
g = GetGrn(pixelLong)
b = GetBlue(pixelLong)
#main.atl "color ";r;" ";g;" ";b
#main.atl "set ";x;" ";y
next x
next y
#main.atl "flush"
#main.atl "getbmp bttnPrev 1 1 30 30"
hButton1 = hwnd(#main.prev)
hBitmap1 = hbmp("bttnPrev")
call SendMessageA hButton1, _BM_SETIMAGE, _IMAGE_BITMAP, hBitmap1
loadbmp "bttnNext", bttnNext$restore [dataNavImage]
for y = 1 to 30
for x = 30 to 1 step -1
read pixelLong
r = GetRed(pixelLong)
g = GetGrn(pixelLong)
b = GetBlue(pixelLong)
#main.atl "color ";r;" ";g;" ";b
#main.atl "set ";x;" ";y
next x
next y
#main.atl "flush"
#main.atl "getbmp bttnNext 1 1 30 30"
hButton2 = hwnd(#main.next)
hBitmap2 = hbmp("bttnNext")
call SendMessageA hButton2, _BM_SETIMAGE, _IMAGE_BITMAP, hBitmap2
loadbmp "bttnSearch", bttnSearch$' Draw and save the search button image
restore [dataSearchImage]
for y = 1 to 30
for x = 1 to 30
read pixelLong
r = GetRed(pixelLong)
g = GetGrn(pixelLong)
b = GetBlue(pixelLong)
#main.atl "color ";r;" ";g;" ";b
#main.atl "set ";x;" ";y
next x
next y
#main.atl "flush"
#main.atl "getbmp bttnSearch 1 1 30 30"
hButton3 = hwnd(#main.go)
hBitmap3 = hbmp("bttnSearch")
call SendMessageA hButton3, _BM_SETIMAGE, _IMAGE_BITMAP, hBitmap3
' Relocate controls
call GetClientRect hwnd(#main)
xMain = rcClient.xLeft.struct
wMain = rcClient.xRight.struct
yMain = rcClient.yUpper.struct
tMain = rcClient.yLower.struct
#main.atl "locate 10 10 565 ";tMain - 30
#main.cmd "locate ";wMain - 210;" 40 190 100"
#main.cmd "down; backcolor buttonface"
call CommandReferences
#main.cmd "flush"
#main.prev"locate"!locate ";wMain - 150;" 14030 30"32 32"
#main.next"locate"!locate ";wMain - 110;" 14030 30"32 32"
#main.srch "!locate ";wMain - 210;" 180 160 30"
#main.go "!locate ";wMain - 50;"180 30 30"179 32 32"
#main.mtch "locate ";wMain - 210;" 220 190 ";tMain - 240
#main "font verdana 10"
#main "refresh"
#main.mtch "singleclickselect"
#main "trapclose [quit]"
#main.cmd "when mouseMove [htmlCursor]"
#main.cmd "when leftButtonUp [DisplayAlphCommands]"
#main.prev"disable""!disable"
#main.next"disable""!disable"
#main.atl "cls"
' Convert graphicbox to browser display using ATL dll - Thanks to Alyce Watson and Stefan Pendl
hMain = hwnd(#main)
hBrowserContainer = hwnd(#main.atl)
open "atl" for dll as #atl
calldll #atl, "AtlAxWinInit", _
ATLinitialized as long
styleATL = _WS_CHILD or _WS_VISIBLE or _WS_VSCROLL or _WS_HSCROLL
calldll #user32, "GetWindowLongA", _
hMain as ulong, _
_GWL_HINSTANCE as long, _
hInst as ulong
hATL = CreateWindowExA(LBHelpIndex$, styleATL, hBrowserContainer, hInst)
htmlFile$ = LBHelpIndex$
' pageIndex$ holds the first displayed page
pageIndex$ = LBHelpIndex$
' Disable search textbox while html files being read
#main.srch "!Disable"
' Use files() command to find number of Html Help Files
dim info$(10, 10)
files LBHelpPath$, info$()
nHtmlFiles = val(info$(0, 0)) ' Total number of LB Html Help Files
' Searchbox phrases
lp$ = "Loading . . . "
LoadingPhrase$ = ""
for i = 1 to nHtmlFiles / 15
LoadingPhrase$ = LoadingPhrase$;lp$
next i
sp$ = "Searching . . . "
SearchingPhrase$ = ""
for i = 1 to nHtmlFiles / 15
SearchingPhrase$ = SearchingPhrase$;sp$
next i
' Store the file names in an array
dim htmlFiles$(nHtmlFiles)
for i = 1 to nHtmlFiles
htmlFiles$(i) = info$(i, 0)
next i
' Store contents of each file in htmlFiles$()
for i = 1 to nHtmlFiles
html$ = LBHelpPath$;htmlFiles$(i)
open html$ for input as #1
contents$ = input$(#1, LOF(#1))
htmlFiles$(i) = htmlFiles$(i);chr$(0);contents$
close #1
next i
' Store the title of each file in htmlFiles$()
n = 0
for i = 1 to nHtmlFiles
n = n + 1
if n mod 25 = 0 then
#main.srch right$(LoadingPhrase$, n)
end if
htmlTitle$ = ExtractHtmlTitle$(htmlFiles$(i))
htmlFiles$(i) = htmlTitle$;chr$(0);htmlFiles$(i)
next i
' htmlFiles$() format
' htmlTitle$;chr$(0);htmlFilePath$;chr$(0);htmlContents$
' Alphabetize by title
sort htmlFiles$(), 1, nHtmlFiles
' Define an array to hold html files containing search item
dim matchFiles$(nHtmlFiles)
for i = 1 to nHtmlFiles
matchFiles$(i) = htmlFiles$(i)
next i
' Load the match listbox
#main.mtch "reload"
' Enable search textbox
#main.srch "Search for ..."
#main.srch "!enable"
' Load pointing hand cursor - Thanks to Gordon Sweet
hCmd = hwnd(#main.cmd)
call SetClass hCmd
nCursor = 32649
hCursor = LoadCursor(nCursor)
wait
[DisplayAlphCommands]
if cmd <> 0 then
if word$(cmd$(cmd), 2, chr$(0)) <> htmlFile$ then
pageIndex$ = pageIndex$;chr$(0);word$(cmd$(cmd), 2, chr$(0))
viewPage = vPages(pageIndex$)
if viewPage > 1 then
#main.prev"enable""!enable"
end if
#main.next"disable""!disable"
end if
htmlFile$ = word$(cmd$(cmd), 2, chr$(0))
call DestroyWindow hATL
hATL = CreateWindowExA(htmlFile$, styleATL, hBrowserContainer, hInst)
end if
wait
[DisplayHtml]
#main.mtch "selectionindex? nPage"
p$ = LBHelpPath$;word$(matchFiles$(nPage), 2, chr$(0))
if htmlFile$ <> p$ then
pageIndex$ = pageIndex$;chr$(0);p$
viewPage = vPages(pageIndex$)
if viewPage>= 1 then
#main.prev"enable""!disable"
else
#main.prev "!enable"
end if
end if
#main.next"disable""!disable"
htmlFile$ = LBHelpPath$;word$(matchFiles$(nPage), 2, chr$(0))
call DestroyWindow hATL
hATL = CreateWindowExA(htmlFile$, styleATL, hBrowserContainer, hInst)
wait
[search]
#main.srch "!contents? search$"
nSearchFiles = FindMatch(nHtmlFiles, search$)
#main.mtch "reload"
wait
[prevPage]
viewPage = max(viewPage - 1, 1)
if viewPage = 1 then
#main.prev"disable""!disable"
else
#main.prev"enable""!enable"
end if
if viewPage = nPages then
#main.next"disable""!disable"
else
#main.next"enable""!enable"
end if
htmlFile$ = word$(pageIndex$, viewPage, chr$(0))
call DestroyWindow hATL
hATL = CreateWindowExA(htmlFile$, styleATL, hBrowserContainer, hInst)
wait
[nextPage]
viewPage = min(viewPage + 1, vPages(pageIndex$))
if viewPage = 1 then
#main.prev"disable""!disable"
else
#main.prev"enable""!enable"
end if
if viewPage = vPages(pageIndex$) then
#main.next"disable""!disable"
else
#main.next"enable""!enable"
end if
htmlFile$ = word$(pageIndex$, viewPage, chr$(0))
call DestroyWindow hATL
hATL = CreateWindowExA(htmlFile$, styleATL, hBrowserContainer, hInst)
wait
[htmlCursor]
xVar = MouseX
yVar = MouseY
cmd = 0
select case
case yVar > 28 and yVar < 42
select case
case xVar > 37 and xVar < 63
cmd = 1
case xVar > 77 and xVar < 103
cmd = 2
case xVar > 117 and xVar < 143
cmd = 3
end select
case yVar > 50 and yVar < 64
select case
case xVar > 10 and xVar < 36
cmd = 4
case xVar > 55 and xVar < 83
cmd = 5
case xVar > 100 and xVar < 126
cmd = 6
case xVar > 144 and xVar < 170
cmd = 7
end select
case yVar > 72 and yVar < 86
if xVar > 30 then
if xVar < 150 then
cmd = 8
end if
end if
end select
if cmd = 0 then
nCursor = 0
cursor normal
else
nCursor = 32649
call SetCursor hCursor
end if
wait
[quit]
call DestroyWindow hATL
close #atl
close #main
end
[dataNavImage]
data 16777215, 16777215, 16777215, 16777215, 16777215, 16777215, 16777215, 16777215, 16777215, 16777215, 16777215, 16777215, 16777215, 16777215, 16777215, 16777215, 16777215, 16777215, 16777215, 16777215, 16777215, 16777215, 16777215, 16777215, 16777215, 16777215, 16777215, 16777215, 16777215, 16777215,
data 16777215, 16777215, 16777215, 16777215, 16777215, 16777215, 16777215, 16777215, 16777215, 16777215, 16777215, 16777215, 16777215, 16777215, 16777215, 16777215, 16777215, 16777215, 16777215, 16777215, 16777215, 16777215, 16777215, 16777215, 16777215, 16777215, 16777215, 16777215, 16777215, 16777215,
data 16777215, 16777215, 16777215, 16777215, 16777215, 16777215, 16777215, 16777215, 16777215, 16777215, 16777215, 16777215, 16776957, 16710390, 16777215, 16777215, 16777215, 16777215, 16777215, 16777215, 16777215, 16777215, 16777215, 16777215, 16777215, 16777215, 16777215, 16777215, 16777215, 16777215,
data 16777215, 16777215, 16777215, 16777215, 16777215, 16777215, 16777215, 16777215, 16777215, 16777215, 16777215, 16777210, 16639938, 16634800, 16777215, 16777215, 16777215, 16777215, 16777215, 16777215, 16777215, 16777215, 16777215, 16777215, 16777215, 16777215, 16777215, 16777215, 16777215, 16777215,
data 16777215, 16777215, 16777215, 16777215, 16777215, 16777215, 16777215, 16777215, 16777215, 16777215, 16777215, 16707785, 15255703, 16439987, 16777215, 16777215, 16777215, 16777215, 16777215, 16777215, 16777215, 16777215, 16777215, 16777215, 16777215, 16777215, 16777215, 16777215, 16777215, 16777215,
data 16777215, 16777215, 16777215, 16777215, 16777215, 16777215, 16777215, 16777215, 16777215, 16777215, 16773061, 15848875, 14466454, 16440230, 16777215, 16777215, 16777215, 16777215, 16777215, 16777215, 16777215, 16777215, 16777215, 16777215, 16777215, 16777215, 16777215, 16777215, 16777215, 16777215,
data 16777215, 16777215, 16777215, 16777215, 16777215, 16777215, 16777215, 16777215, 16777215, 16774352, 16176041, 15320731, 14859919, 16506789, 16777215, 16777215, 16777214, 16777215, 16777214, 16777214, 16776958, 16776958, 16776958, 16776957, 16776958, 16777215, 16777215, 16777215, 16777215, 16777215,
data 16777215, 16777215, 16777215, 16777215, 16777215, 16777215, 16777215, 16711677, 16643288, 16112558, 15714456, 15650453, 15123850, 16242589, 16640456, 16507838, 16309432, 16375738, 15914930, 15848624, 15650730, 15452837, 15452319, 15318677, 16181207, 16777215, 16777215, 16777215, 16777215, 16777215,
data 16777215, 16777215, 16777215, 16777215, 16777215, 16777215, 16777215, 16709846, 15982517, 15585443, 16109972, 15453583, 15584140, 15582085, 15449984, 15252092, 15185785, 14725746, 14264423, 14395237, 14197084, 13998418, 14063179, 13862966, 15586229, 16777215, 16777215, 16777215, 16777215, 16777215,
data 16777215, 16777215, 16777215, 16777215, 16777215, 16777215, 16776665, 16246460, 15914665, 16243102, 15847824, 15321746, 15648650, 16239234, 15384189, 15186809, 14988401, 14724459, 14855271, 14722397, 14656087, 14589261, 14653766, 14191148, 15783091, 16777215, 16777215, 16777215, 16777215, 16777215,
data 16777215, 16777215, 16777215, 16777215, 16777215, 16776416, 16377276, 16046511, 16243625, 16045723, 15650193, 15846293, 16041867, 15712379, 15515001, 15513973, 15316078, 15184491, 14853983, 14918747, 14852437, 14785869, 14456130, 13993515, 15717556, 16777215, 16777215, 16777215, 16777215, 16777215,
data 16777215, 16777215, 16777215, 16777214, 16776414, 16575182, 16441023, 16506801, 16374699, 16177058, 16044186, 15845264, 15909768, 15843968, 15711861, 15448687, 15316587, 15117923, 14985565, 14984536, 14720849, 14589259, 14127938, 13666349, 15652277, 16777215, 16777215, 16777215, 16777215, 16777215,
data 16777215, 16777215, 16777212, 16776155, 16643027, 16573386, 16769725, 16637874, 16439980, 16045219, 15847319, 16041613, 15778693, 15515516, 15514994, 15317354, 15185254, 15052637, 15051609, 14853458, 14720845, 14260293, 13996863, 13535791, 15586741, 16777215, 16777215, 16777215, 16777215, 16777215,
data 16777215, 16777215, 16777208, 16776389, 16444365, 16377544, 16048310, 16441267, 16439723, 16045214, 15912847, 16172677, 15778943, 15056250, 15514995, 15185258, 14987876, 15117661, 15051096, 14721873, 14589512, 14522181, 14324541, 13863724, 15717812, 16777215, 16777215, 16777215, 16777215, 16777215,
data 16777215, 16777215, 16777215, 16777207, 16774860, 16049606, 15984064, 16113069, 16242340, 16241049, 16174985, 15845500, 15712889, 15252597, 15382386, 15053418, 15117927, 14920029, 14918997, 14917712, 14785351, 14653761, 14521406, 14190893, 15848884, 16777215, 16777215, 16777215, 16777215, 16777215,
data 16777215, 16777215, 16777215, 16777215, 16776943, 16643285, 15850934, 15980968, 15848864, 16044181, 16304775, 15714169, 15581814, 15448435, 15512429, 15314791, 15117154, 15050842, 15049556, 14786125, 14654280, 14587973, 14521152, 14190639, 15848629, 16777215, 16777215, 16777215, 16777215, 16777215,
data 16777215, 16777215, 16777215, 16777215, 16777215, 16776951, 16773051, 16046763, 15323289, 15584912, 15910534, 15712633, 15646069, 15513712, 15774567, 15380063, 15248218, 14985043, 14984272, 14655047, 14523204, 14457154, 14325054, 13928238, 15717813, 16777215, 16777215, 16777215, 16777215, 16777215,
data 16777215, 16777215, 16777215, 16777215, 16777215, 16777215, 16776434, 16508085, 15585435, 15386763, 15778686, 16039544, 15579762, 15185255, 14789212, 14592086, 14525777, 14131274, 14064454, 13932611, 13997375, 13865788, 13667897, 13205547, 15454644, 16777215, 16777215, 16777215, 16777215, 16777215,
data 16777215, 16777215, 16777215, 16777215, 16777215, 16777215, 16777215, 16776950, 16639158, 15779207, 15645556, 15645297, 15119207, 15909492, 15583622, 15516288, 15186551, 15186293, 14856305, 14986349, 14854502, 14591837, 14328155, 13799760, 15652544, 16777215, 16777215, 16777215, 16777215, 16777215,
data 16777215, 16777215, 16777215, 16777215, 16777215, 16777215, 16777215, 16777215, 16710382, 16703653, 15187583, 14792047, 14330727, 16437385, 16777211, 16775402, 16774376, 16775146, 16774376, 16708326, 16708068, 16576483, 16510688, 16313053, 16578547, 16777215, 16777215, 16777215, 16777215, 16777215,
data 16777215, 16777215, 16777215, 16777215, 16777215, 16777215, 16777215, 16777215, 16777215, 16776691, 16307341, 14793335, 13542245, 16305549, 16777215, 16777215, 16777215, 16777215, 16777215, 16777215, 16777215, 16777215, 16777215, 16777215, 16777215, 16777215, 16777215, 16777215, 16777215, 16777215,
data 16777215, 16777215, 16777215, 16777215, 16777215, 16777215, 16777215, 16777215, 16777215, 16777215, 16775656, 16109194, 13672806, 16303493, 16777215, 16777215, 16777215, 16777215, 16777215, 16777215, 16777215, 16777215, 16777215, 16777215, 16777215, 16777215, 16777215, 16777215, 16777215, 16777215,
data 16777215, 16777215, 16777215, 16777215, 16777215, 16777215, 16777215, 16777215, 16777215, 16777215, 16777215, 16776173, 15845003, 16369545, 16777215, 16777215, 16777215, 16777215, 16777215, 16777215, 16777215, 16777215, 16777215, 16777215, 16777215, 16777215, 16777215, 16777215, 16777215, 16777215,
data 16777215, 16777215, 16777215, 16777215, 16777215, 16777215, 16777215, 16777215, 16777215, 16777215, 16777215, 16777215, 16773599, 16238215, 16777215, 16777215, 16777215, 16777215, 16777215, 16777215, 16777215, 16777215, 16777215, 16777215, 16777215, 16777215, 16777215, 16777215, 16777215, 16777215,
data 16777215, 16777215, 16777215, 16777215, 16777215, 16777215, 16777215, 16777215, 16777215, 16777215, 16777215, 16777215, 16777215, 16641241, 16777215, 16777215, 16777215, 16777215, 16777215, 16777215, 16777215, 16777215, 16777215, 16777215, 16777215, 16777215, 16777215, 16777215, 16777215, 16777215,
data 16777215, 16777215, 16777215, 16777215, 16777215, 16777215, 16777215, 16777215, 16777215, 16777215, 16777215, 16777215, 16777215, 16777215, 16777215, 16777215, 16777215, 16777215, 16777215, 16777215, 16777215, 16777215, 16777215, 16777215, 16777215, 16777215, 16777215, 16777215, 16777215, 16777215,
data 16777215, 16777215, 16777215, 16777215, 16777215, 16777215, 16777215, 16777215, 16777215, 16777215, 16777215, 16777215, 16777215, 16777215, 16777215, 16777215, 16777215, 16777215, 16777215, 16777215, 16777215, 16777215, 16777215, 16777215, 16777215, 16777215, 16777215, 16777215, 16777215, 16777215,
data 16777215, 16777215, 16777215, 16777215, 16777215, 16777215, 16777215, 16777215, 16777215, 16777215, 16777215, 16777215, 16777215, 16777215, 16777215, 16777215, 16777215, 16777215, 16777215, 16777215, 16777215, 16777215, 16777215, 16777215, 16777215, 16777215, 16777215, 16777215, 16777215, 16777215,
data 16777215, 16777215, 16777215, 16777215, 16777215, 16777215, 16777215, 16777215, 16777215, 16777215, 16777215, 16777215, 16777215, 16777215, 16777215, 16777215, 16777215, 16777215, 16777215, 16777215, 16777215, 16777215, 16777215, 16777215, 16777215, 16777215, 16777215, 16777215, 16777215, 16777215,
data 16777215, 16777215, 16777215, 16777215, 16777215, 16777215, 16777215, 16777215, 16777215, 16777215, 16777215, 16777215, 16777215, 16777215, 16777215, 16777215, 16777215, 16777215, 16777215, 16777215, 16777215, 16777215, 16777215, 16777215, 16777215, 16777215, 16777215, 16777215, 16777215, 16777215,
[dataSearchImage]
data 16777215, 16777215, 16777215, 16777215, 16777215, 16777215, 16777215, 16777215, 16777215, 16777215, 16777215, 16777215, 16777215, 16777215, 16777215, 16777215, 16777215, 16777215, 16777215, 16777215, 16777215, 16777215, 16777215, 16777215, 16777215, 16777215, 16777215, 16777215, 16777215, 16777215,
data 16777215, 16777215, 16777215, 16777215, 16777215, 16777215, 16777215, 16777215, 16777215, 16777215, 16777215, 16777215, 16777215, 16777215, 16777215, 16777215, 16777215, 16777215, 16777215, 16777215, 16777215, 16777215, 16777215, 16777215, 16777215, 16777215, 16777215, 16777215, 16777215, 16777215,
data 16777215, 16777215, 16777215, 16777215, 16777215, 16777215, 16777215, 16777215, 16777215, 16777215, 16777215, 16777215, 16777215, 16777215, 16777215, 16777215, 16777215, 16777215, 16777215, 16777215, 16777215, 16777215, 16777215, 16777215, 16777215, 16777215, 16777215, 16777215, 16777215, 16777215,
data 16777215, 16777215, 16777215, 16777215, 16777215, 16777215, 16777215, 16777215, 16777215, 16777215, 16777215, 16777215, 16777215, 15066596, 14211029, 14934495, 15263460, 15197924, 16052979, 16777215, 16777215, 16777215, 16777215, 16777215, 16777215, 16777215, 16777215, 16777215, 16777215, 16777215,
data 16777215, 16777215, 16777215, 16777215, 16777215, 16777215, 16777215, 16777215, 16777215, 16777215, 16777215, 16447992, 13618632, 11381666, 11117464, 10918800, 10787213, 10655627, 12235180, 16645114, 16777215, 16777215, 16777215, 16777215, 16777215, 16777215, 16777215, 16777215, 16777215, 16777215,
data 16777215, 16777215, 16777215, 16777215, 16777215, 16777215, 16777215, 16777215, 16777215, 16777215, 16382457, 11116956, 11314074, 11116692, 12101269, 14601397, 15851463, 16180429, 12167317, 12498608, 16052979, 16777215, 16777215, 16777215, 16777215, 16777215, 16777215, 16777215, 16777215, 16777215,
data 16777215, 16777215, 16777215, 16777215, 16777215, 16777215, 16777215, 16777215, 16777215, 16777215, 8156784, 10129542, 11838094, 13876903, 16771789, 16573124, 16506813, 16770242, 15852221, 7891028, 11709863, 16251128, 16777215, 16777215, 16777215, 16777215, 16777215, 16777215, 16777215, 16777215,
data 16777215, 16777215, 16777215, 16777215, 16777215, 16777215, 16777215, 16777215, 16777215, 9868434, 6973024, 11575952, 14467485, 16441526, 16308656, 16440498, 16506036, 16440757, 16375729, 11376490, 8879981, 13684688, 16777215, 16777215, 16777215, 16777215, 16777215, 16777215, 16777215, 16777215,
data 16777215, 16777215, 16777215, 16777215, 16777215, 16777215, 16777215, 16777215, 13026757, 5393478, 10721929, 14074009, 16571295, 15978635, 15913089, 15782012, 15979137, 16308879, 16773035, 15521934, 9207134, 10722711, 16777215, 16777215, 16777215, 16777215, 16777215, 16777215, 16777215, 16777215,
data 16777215, 16777215, 16777215, 16777215, 16777215, 16777215, 16777215, 16777215, 9144968, 6247755, 12035467, 15849626, 16439431, 16109942, 16373101, 16175715, 15978853, 15649893, 16113021, 16773014, 9863772, 9537913, 16711674, 16777215, 16777215, 16777215, 16777215, 16777215, 16777215, 16777215,
data 16777215, 16777215, 16777215, 16777215, 16777215, 16777215, 16777215, 16777215, 8750975, 7102806, 12429961, 16311446, 16376706, 16507519, 16638581, 16768880, 16769131, 16571751, 16113248, 16379248, 9536334, 9800323, 16777215, 16777215, 16777215, 16777215, 16777215, 16777215, 16777215, 16777215,
data 16777215, 16777215, 16777215, 16777215, 16777215, 16777215, 16777215, 16777215, 8948098, 6840406, 12167820, 16510366, 16509836, 16443526, 16574847, 16770938, 16705397, 16639341, 16772455, 14406470, 8025404, 10195606, 16777215, 16777215, 16777215, 16777215, 16777215, 16777215, 16777215, 16777215,
data 16777215, 16777215, 16777215, 16777215, 16777215, 16777215, 16777215, 16777215, 10790047, 6247764, 11050118, 16511654, 16708249, 16576147, 16576138, 16576643, 16576124, 16708217, 16575852, 12234052, 8091219, 12039605, 16777215, 16777215, 16777215, 16777215, 16777215, 16777215, 16777215, 16777215,
data 16777215, 16777215, 16777215, 16777215, 16777215, 16777215, 16777215, 16777215, 14211286, 5129286, 10392707, 15395235, 16775851, 16774046, 16643730, 16578442, 16709766, 16578172, 16380790, 10256723, 8945270, 15462376, 16777215, 16777215, 16777215, 16777215, 16777215, 16777215, 16777215, 16777215,
data 16777215, 16777215, 16777215, 16777215, 16777215, 16777215, 16777215, 16777215, 16777215, 8949381, 6775383, 12366737, 16776637, 16776874, 16710814, 16775332, 16710554, 16777098, 14410626, 9208190, 12959422, 16776959, 16777215, 16777215, 16777215, 16777215, 16777215, 16777215, 16777215, 16777215,
data 16777215, 16777215, 16777215, 16777215, 16777215, 16777215, 16777215, 16777215, 16777215, 16447995, 7037780, 8945510, 13684127, 16382387, 16777140, 16644529, 16316576, 15397010, 12169871, 11577003, 16119028, 16777215, 16777215, 16777215, 16777215, 16777215, 16777215, 16777215, 16777215, 16777215,
data 16777215, 16777215, 16777215, 16777215, 16777215, 16777215, 16777215, 16777215, 16777215, 16777215, 11842486, 9077112, 9143926, 11841687, 13027216, 13224337, 12630678, 11840407, 11578017, 16250617, 16777215, 16777215, 16777215, 16777215, 16777215, 16777215, 16777215, 16777215, 16777215, 16777215,
data 16777215, 16777215, 16777215, 16777215, 16777215, 16777215, 16777215, 16777215, 14805743, 9879266, 9088463, 11252147, 14934493, 12302008, 9735563, 10064010, 10393487, 11907247, 14935008, 16777215, 16777215, 16777215, 16777215, 16777215, 16777215, 16777215, 16777215, 16777215, 16777215, 16777215,
data 16777215, 16777215, 16777215, 16777215, 16777215, 16777215, 16777215, 16250872, 8960215, 6600430, 2711184, 15726329, 16777215, 16777215, 16777215, 16777215, 16777215, 16777215, 16777215, 16777215, 16777215, 16777215, 16777215, 16777215, 16777215, 16777215, 16777215, 16777215, 16777215, 16777215,
data 16777215, 16777215, 16777215, 16777215, 16777215, 16777215, 14147047, 5670836, 3111097, 11884, 16777212, 16777215, 16777215, 16777215, 16777215, 16777215, 16777215, 16777215, 16777215, 16777215, 16777215, 16777215, 16777215, 16777215, 16777215, 16777215, 16777215, 16777215, 16777215, 16777215,
data 16777215, 16777215, 16777215, 16777215, 16777215, 15068144, 4025756, 7455735, 2977184, 10728392, 16777215, 16777215, 16777215, 16777215, 16777215, 16777215, 16777215, 16777215, 16777215, 16777215, 16777215, 16777215, 16777215, 16777215, 16777215, 16777215, 16777215, 16777215, 16777215, 16777215,
data 16777215, 16777215, 16777215, 16777215, 16579839, 3561595, 6863600, 6402539, 7246259, 16776700, 16777215, 16777215, 16777215, 16777215, 16777215, 16777215, 16777215, 16777215, 16777215, 16777215, 16777215, 16777215, 16777215, 16777215, 16777215, 16777215, 16777215, 16777215, 16777215, 16777215,
data 16777215, 16777215, 16777215, 16777215, 9676215, 6794466, 7259130, 15997, 10792897, 16777215, 16777215, 16777215, 16777215, 16777215, 16777215, 16777215, 16777215, 16777215, 16777215, 16777215, 16777215, 16777215, 16777215, 16777215, 16777215, 16777215, 16777215, 16777215, 16777215, 16777215,
data 16777215, 16777215, 16777215, 16777215, 12047076, 6797037, 543879, 1326697, 14014688, 16777215, 16777215, 16777215, 16777215, 16777215, 16777215, 16777215, 16777215, 16777215, 16777215, 16777215, 16777215, 16777215, 16777215, 16777215, 16777215, 16777215, 16777215, 16777215, 16777215, 16777215,
data 16777215, 16777215, 16777215, 16777215, 15200245, 12441065, 10334401, 12963029, 16777215, 16777215, 16777215, 16777215, 16777215, 16777215, 16777215, 16777215, 16777215, 16777215, 16777215, 16777215, 16777215, 16777215, 16777215, 16777215, 16777215, 16777215, 16777215, 16777215, 16777215, 16777215,
data 16777215, 16777215, 16777215, 16777215, 16777215, 16777215, 16777215, 16777215, 16777215, 16777215, 16777215, 16777215, 16777215, 16777215, 16777215, 16777215, 16777215, 16777215, 16777215, 16777215, 16777215, 16777215, 16777215, 16777215, 16777215, 16777215, 16777215, 16777215, 16777215, 16777215,
data 16777215, 16777215, 16777215, 16777215, 16777215, 16777215, 16777215, 16777215, 16777215, 16777215, 16777215, 16777215, 16777215, 16777215, 16777215, 16777215, 16777215, 16777215, 16777215, 16777215, 16777215, 16777215, 16777215, 16777215, 16777215, 16777215, 16777215, 16777215, 16777215, 16777215,
data 16777215, 16777215, 16777215, 16777215, 16777215, 16777215, 16777215, 16777215, 16777215, 16777215, 16777215, 16777215, 16777215, 16777215, 16777215, 16777215, 16777215, 16777215, 16777215, 16777215, 16777215, 16777215, 16777215, 16777215, 16777215, 16777215, 16777215, 16777215, 16777215, 16777215,
data 16777215, 16777215, 16777215, 16777215, 16777215, 16777215, 16777215, 16777215, 16777215, 16777215, 16777215, 16777215, 16777215, 16777215, 16777215, 16777215, 16777215, 16777215, 16777215, 16777215, 16777215, 16777215, 16777215, 16777215, 16777215, 16777215, 16777215, 16777215, 16777215, 16777215,
data 16777215, 16777215, 16777215, 16777215, 16777215, 16777215, 16777215, 16777215, 16777215, 16777215, 16777215, 16777215, 16777215, 16777215, 16777215, 16777215, 16777215, 16777215, 16777215, 16777215, 16777215, 16777215, 16777215, 16777215, 16777215, 16777215, 16777215, 16777215, 16777215, 16777215,
function GetRed(longInt)
GetRed = longInt And 255
end function
function GetGrn(longInt)
GetGrn = (longInt And 65280)/256
end function
function GetBlue(longInt)
GetBlue = (longInt And 16711680)/65536
end function
function FindMatch(nFiles, search$)
ct = 0
redim matchFiles$(nFiles)
for ii = 1 to nFiles
contents$ = word$(htmlFiles$(ii), 1, chr$(0));word$(htmlFiles$(ii), 3, chr$(0))
if instr(upper$(contents$), upper$(search$)) > 0 then
ct = ct + 1
matchFiles$(ct) = htmlFiles$(ii)
end if
next ii
FindMatch = ct
end function
function GetModuleFileName$()
nSize = _MAX_PATH + 1
lpFilename$ = space$(nSize); CHR$(0)
calldll #kernel32, "GetModuleFileNameA", _
hModule as ulong, _
lpFilename$ as ptr, _
nSize as ulong, _
result as ulong
if result > 0 then
GetModuleFileName$ = trim$(lpFilename$)
end if
end function
function GetLBPath$(LBModulePath$)
pos = 0
for ii = len(LBModulePath$) to 1 step -1
if mid$(LBModulePath$, ii, 1) = "\" then
pos = ii
exit for
end if
next ii
GetLBPath$ = left$(LBModulePath$, pos)
end function
function ExtractHtmlTitle$(contents$)
c1a$ = ""
c1b$ = ""
c2$ = ""
tag1a$ = "<A NAME=";chr$(34)
tag1b$ = chr$(34);"></A><B>"
tag2$ = "</B></P>"
pos1a = 0
pos1b = 0
pos2 = 0
if instr(upper$(contents$), tag1a$) > 0 then
pos1a = instr(upper$(contents$), tag1a$) + len(tag1a$) + 1
c1a$ = mid$(contents$, pos1a)
end if
if instr(upper$(c1a$), tag1b$) > 0 then
pos1b = instr(upper$(c1a$), tag1b$) + len(tag1b$)
c1b$ = mid$(c1a$, pos1b)
end if
if instr(upper$(c1b$), tag2$) > 0 then
pos2 = instr(upper$(c1b$), tag2$) - 1
ExtractHtmlTitle$ = trim$(left$(c1b$, pos2))
end if
if ExtractHtmlTitle$ <> "" then
exit function
end if
tag1$ = "<P><B>"
tag2$ = "</B></P>"
pos1 = instr(upper$(contents$), tag1$) + len(tag1$)
c1$ = mid$(contents$, pos1)
pos2 = instr(upper$(c1$), tag2$)
ExtractHtmlTitle$ = left$(c1$, pos2 - 1)
end function
sub SendMessageA hControl, param1, param2, param3
calldll #user32, "SendMessageA", _
hControl as ulong, _
param1 as long, _
param2 as long, _
param3 as long, _
result as long
end sub
sub GetClientRect hControl
calldll #user32, "GetClientRect", _
hControl as ulong, _
rcClient as struct, _
result as long
end sub
function CreateWindowExA(page$, style, hParent, hInst)
call GetClientRect hwnd(#main)
wATL = rcClient.xRight.struct - 230
tMain = rcClient.yLower.struct - 30
calldll #user32, "CreateWindowExA", _
_WS_EX_CLIENTEDGE as ulong, _
"ATLAxWin" as ptr, _
page$ as ptr, _
style as ulong, _
0 as long, _
0 as long, _
wATL as long, _
tMain as long, _
hParent as ulong, _
_NULL as ulong, _
hInst as ulong, _
_NULL as ulong, _
CreateWindowExA as ulong
end function
sub SetClass hControl
index = _GCL_HCURSOR or 0
calldll #user32, "SetClassLongA", _
hControl as ulong, _
index as long, _
0 as long, _
result as long
end sub
sub SetCursor hCursor
calldll #user32, "SetCursor", _
hCursor as ulong, _
result as long
end sub
function LoadCursor(nCursor)
flags = hexdec("8000") or _LR_DEFAULTSIZE
calldll #user32, "LoadImageA", _
0 as long, _
nCursor as long, _
_IMAGE_CURSOR as long, _
0 as long, _
0 as long, _
flags as long, _
hCursor as uLong
call SetCursor hCursor
LoadCursor = hCursor
end function
sub DestroyWindow hATL
calldll #user32, "DestroyWindow", _
hATL as ulong, _
result as long
end sub
sub CommandReferences
#main.cmd "place -10 -10; boxfilled 210 110"
#main.cmd "font verdana 10 bold; color black"
t$ = "LB Command References"
#main.cmd "stringwidth? t$ wdth"
#main.cmd "place ";int(90 - wdth / 2);" 16"
#main.cmd "\";t$
#main.cmd "font verdana 10 underscore; color blue"
t$ = "A-C"
#main.cmd "stringwidth? t$ wdth"
#main.cmd "place ";int(50 - wdth / 2);" 40"
#main.cmd "\";t$
t$ = "D-F"
#main.cmd "stringwidth? t$ wdth"
#main.cmd "place ";int(90 - wdth / 2);" 40"
#main.cmd "\";t$
t$ = "G-K"
#main.cmd "stringwidth? t$ wdth"
#main.cmd "place ";int(130 - wdth / 2);" 40"
#main.cmd "\";t$
t$ = "L-M"
#main.cmd "stringwidth? t$ wdth"
#main.cmd "place ";int(23 - wdth / 2);" 62"
#main.cmd "\";t$
t$ = "N-P"
#main.cmd "stringwidth? t$ wdth"
#main.cmd "place ";int(68 - wdth / 2);" 62"
#main.cmd "\";t$
t$ = "R-S"
#main.cmd "stringwidth? t$ wdth"
#main.cmd "place ";int(113 - wdth / 2);" 62"
#main.cmd "\";t$
t$ = "T-Z"
#main.cmd "stringwidth? t$ wdth"
#main.cmd "place ";int(157 - wdth / 2);" 62"
#main.cmd "\";t$
t$ = "Quick Start Guide"
#main.cmd "stringwidth? t$ wdth"
#main.cmd "place ";int(90 - wdth / 2);" 86"
#main.cmd "\";t$
#main.cmd "flush"
end sub
function vPages(pageIndex$)
vPages = 1
pageIndex$ = trim$(pageIndex$)
while instr(pageIndex$, chr$(0)) > 0
vPages = vPages + 1
if instr(pageIndex$, chr$(0)) > 0 then
pos = instr(pageIndex$, chr$(0)) + 1
pageIndex$ = mid$(pageIndex$, pos)
end if
wend
end function
It is likely that improvements will be made to this code before the contest deadline.
May 3, 2011 - Images for bitmap buttons created 'on the fly' rather than loading bmp files