April 29, 2024, 07:36:30 AM

News:

IonicWind Snippit Manager 2.xx Released!  Install it on a memory stick and take it with you!  With or without IWBasic!


CB Browser

Started by MarineDon, February 14, 2009, 03:15:25 PM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

MarineDon

February 14, 2009, 03:15:25 PM Last Edit: April 04, 2009, 02:21:30 PM by MarineDon
Here is the CB Browser written  in Creative BASIC, dated 23 January 2009.
I leaned heavily on the Browser.Cba program which is part of the CB
package. It is principally designed as an offline browser but it may be
used as on online browser also. I plan to use it with the genealogy CDs
which I send out to relatives. After installing the genealogy program to
hard disk, the main start up file, index.html, will be viewed in the CB
Browser. By the way, since CB Browser is freeware and public domain
any forum member may modify it, change its name and make themselves
the author. No need to cite my name as author.

I just recompiled CBB.CBA with Emergence BASIC (CBB.EBA) with a
reduction in size from 394,752 bytes to 137,432 size. Incredible!! I love it!

My genealogy site: http://www.smithselfgen.com

My QuickBasic 4.5 website: http://www.smithselfgen.com/QuickBasic/QuickBasic.Htm

Download the CB Browser with code here: http://www.smithselfgen.com/QuickBasic/CBB.ZIP

Regards, Don Smith [MarineDon]


EBA Code here:

'===============================================================
'CB browser   Offline/Online Internet Browser
'             FreeWare, Public Domain Program
'             By: Don Smith [MarineDon}
'             Date: January 23, 2009
'===============================================================
$MAIN
AutoDefine "Off"
Def Version$:String:Version$=""
Def BrowseCMDTemp$:String
'CB browser 
'=============================================================== 
DECLARE "kernel32",GetCommandLineA(),STRING 
Def wb,w1,wc:window 
Def left,top,width,height,Yesyes,xyz,x,y,w,h,pos,run,shutdown:int 
Def url$,url$1,url$2,url$3,url$4,url$5,url$6,url$7,url$8,url$9,url$10:string 
Def url$11,url$12,url$13,url$14,url$15,url$16,url$17,url$18,url$19,url$20:string 
Def url$21,url$22,url$23,url$24,url$25,url$26,url$27,url$28,url$29,url$30:string 
Def url$31,url$32,url$33,url$34,url$35,url$36,url$37,url$38,url$39,url$40:string 
Def TempString,MidSpace,NewSpace,ln,start,begin,filename,hp:STRING 
Def file1:FILE
Def buffer[32766]:ISTRING 
left=0 
top=0 
width=208 
height=24 
w=1014
h=850 
url$="" 
'======================[Main Window]============================= 
OpenWindow w1,x,y,w,h,@size|@minbox|@maxbox,0,"CB Browser",&main 
'================================================================ 
'CONTROL features: 
'================ 
'B creates a button 
'E creates an edit box 
'S creates a scrollbar 
'R creates a radio button 
'C creates a check box 
'L creates a list box 
'M creates a combo box 
'T creates a static text control 
'LV creates a List View control 
'RE creates a Rich Edit control 
'SW creates a status window 
'=============================================================== 
GETCLIENTSIZE w1,left,top,width,height 
'================================================================ 
SETFONT w1,"MS Sans Serif",8, 400,0 
SETWINDOWCOLOR w1,rgb(153,160,219) 
'================================================================ 
CONTROL w1,@Edit,"",220,5,490,22,0x50800000|@tabstop,5
SETFONT w1,"MS Sans Serif",8, 400,0,5 
Move w1,197,10:Print w1,"URL" 
'================================================================ 
CONTROL w1,@Button,"GO",717,6,40,20,0x50000000|@CTLBTNDEFAULT,1
SETFONT w1,"MS Sans Serif",8, 400,0,1 
'================================================================= 
CONTROL w1,@Button,"<=",5,6,40,20,0x50000001,12
SETFONT w1,"MS Sans Serif",8, 400,0,1 
'================================================================= 
CONTROL w1,@Button,"=>",50,6,40,20,0x50000001,13
SETFONT w1,"MS Sans Serif",8, 400,0,1 
'================================================================= 
CONTROL w1,@Button,"Print",96,6,40,20,0x50000001,15
SETFONT w1,"MS Sans Serif",8, 400,0,1 
'================================================================ 
CONTROL w1,@Button,"Info",141,6,38,20,0x50000001,16
SETFONT w1,"MS Sans Serif",8, 400,0,1 
'================================================================= 
CONTROL w1,@ComboBox,"",760,6,210,580,0x50A10642,18
SETFONT w1,"MS Sans Serif",8, 400,0,18 
'================================================================= 
if( openfile(file1,"LoadURLs.Txt","R") = 0) 
    closefile file1 
    gosub doopen           
else 
'If Yesyes <> 0 
    url$1="http://www.smithselfgen.com" 
    url$2="http://www.network54.com/Index/10167" 
    url$3="http://www.qbasicstation.com/index.php?c=p_member" 
    url$4="http://www.chebucto.ns.ca/~ak621/DOS/index.html" 
    url$5="http://www.royscott.gwteamplay.com/" 
    url$6="http://www.freewarefiles.com/top100_downloads.php" 
    url$7="http://www.angelfire.com/d20/quickbasic/" 
    url$8="http://www.dogpile.com/" 
    url$9="http://ixquick.com/" 
    url$10="http://www.petesqbsite.com/" 
    url$11="http://www.google.com/" 
    url$12="http://www.cuil.com/" 
    url$13="http://www.coasttocoastam.com/" 
    url$14="http://www.usps.com/tools/calculatepostage/welcome.htm" 
    url$15="http://www.virginmobileusa.com/" 
    url$16="http://www.alistapart.com/articles/horizdropdowns" 
    url$17="http://www.basic.mindteq.com/" 
    url$18="http://www.searchenginecolossus.com/" 
    url$19="http://www.hitmill.com/html/index.html" 
    url$20="http://www.ascii-world.com/" 
    url$21="http://www.frontiernet.net/~fys/index.htm" 
    '================================================================= 
    AddString w1,18,url$1 
    AddString w1,18,url$2 
    AddString w1,18,url$3 
    AddString w1,18,url$4 
    AddString w1,18,url$5 
    AddString w1,18,url$6 
    AddString w1,18,url$7 
    AddString w1,18,url$8 
    AddString w1,18,url$9 
    AddString w1,18,url$10 
    AddString w1,18,url$11 
    AddString w1,18,url$13 
    AddString w1,18,url$14 
    AddString w1,18,url$15 
    AddString w1,18,url$16 
    AddString w1,18,url$17 
    AddString w1,18,url$18 
    AddString w1,18,url$19 
    AddString w1,18,url$20 
    AddString w1,18,url$21 
endif 
' +-----------------------------------------------------------------+ 
' | Find out if there is a HTML command line parameter. If there is,|   
' | if is to be called "NewSpace".                                  | 
' +-----------------------------------------------------------------+ 
TempString = GetCommandLineA():'Get the Command Line String 
TempString=rtrim$(ltrim$(TempString)) 

if TempString<> "" 
    if len(TempString) > 0 
        FOR x = 1 TO LEN(TempString) 
            MidSpace = MID$(TempString, x, 1) 
            IF MidSpace = string$(1, " ") 
                NewSpace = MID$(TempString, x + 1, LEN(TempString) - x)         
            ENDIF 
        NEXT x     
    endif 
endif 
'==============================[Browser Window]====================================
OpenWindow wb,10,50,986,748,@NOAUTODRAW|@NOCAPTION|@BORDER,w1,"Browser",&main 
AttachBrowser(wb)
'==================================================================================
$include "windows.inc"
int g_hook = _SetWindowsHookEx(WH_KEYBOARD, &kbHookProc, 0, _GetCurrentThreadId())
If NewSpace = "" 
    BROWSECMD wb,@NAVIGATE,"http://ixquick.com/"     
else 
    begin = GETSTARTPATH 
    BROWSECMD wb,@NAVIGATE,begin + NewSpace 
endif 
SETCONTROLTEXT w1,1,"GO" 
run = 1 
WAITUNTIL run = 0
Closewindow wb 
Closewindow w1
_UnhookWindowsHookEx(g_hook)
End 
'======================================================================== 
SUB main 
SELECT @CLASS           
    '==================================================================== 
CASE @IDCLOSEWINDOW 
    run = 0 
    '==================================================================== 
CASE @IDCREATE 
Centerwindow w1 
    '==================================================================== 
    CASE @IDNAVCOMPLETE 
    BROWSECMD(wb,@GETNAVURL,BrowseCMDTemp$)
    SETCONTROLTEXT w1,5,BrowseCMDTemp$             
    '====================================================================   
CASE @IDCONTROL       
        IF @CONTROLID = 1 
url$=GETCONTROLTEXT(w1,5)             
    pos=GETSELECTED (w1, 18) 
    SETCONTROLTEXT w1,5,Getstring(w1,18,pos)   
    BROWSECMD wb,@NAVIGATE,GETCONTROLTEXT(w1,5) 
    setfocus w1       
ENDIF     
'================================================================= 
IF @CONTROLID = 12 
IF GETCONTROLTEXT(w1,5)=""   
Messagebox wb,"URL Adress not enter!","Info" 
ELSE 
IF @BACKENABLED then BROWSECMD wb,@GOBACK 
ENDIF 
    ENDIF 
'================================================================= 
IF @controlid = 13 
IF @FORWARDENABLED then BROWSECMD wb,@GOFORWARD 
ENDIF 
'================================================================= 
  IF @CONTROLID = 14 
BROWSECMD wb,@BROWSESTOP 
    ENDIF 
'================================================================= 
IF @CONTROLID = 15 
BROWSECMD wb,@BROWSEPRINT 
ENDIF 
'================================================================= 
IF @CONTROLID = 16 
ProgramInfo()             
ENDIF 
        '================================================================= 
        IF @CONTROLID = 20 
AddURL() 
ENDIF 
'=====================================================================   
CASE @IDKEYDOWN 
IF @CODE = 0x1B 
    url$=GETCONTROLTEXT(w1,5) 
BROWSECMD wb,@NAVIGATE,url$ 
setfocus w1              
ENDIF  
        '===================================================================== 
CASE @IDSIZE 
GETSIZE(w1,x,y,w,h) 
IF (wb <> 0) 
x = 5 
y = 50 
w = w - 18 
h = h - 90  
SETSIZE(wb,x,y,w,h)  
ENDIF 
'===================================================================== 
CASE @IDCREATE 
CENTERWINDOW w1 
CONTROLCMD w1,98,@TBRESIZE 
'===================================================================== 
CASE @IDERASEBACKGROUND  
IF CONTROLEXISTS(w1,98)  
GETSIZE w1,left,top,width,height,98 
'============================================================= 
RECT w1,0,0,width+1,height,RGB(200,200,200),RGB(200,200,200)      
ENDIF 
'=====================================================================         
ENDSELECT 
RETURN 
EndSub

sub kbHookProc(int code, int key, int repeat),int
if (key = 0x1B) then run = 0
return _CallNextHookEx(g_hook, code, key, repeat)
endsub

SUB ProgramInfo
'message box 
Def a$[100]:istring 
Def b$[100]:istring 
Def c$[100]:istring     
Def d$[100]:istring 
Def e$[100]:istring 
Def f$[100]:istring 
Def g$[100]:istring 
Def h$[100]:istring 
Def i$[100]:istring 
Def j$[100]:istring 
Def k$[100]:istring 
Def l$[100]:istring 
Def m$[100]:istring 
Def n$[100]:istring     
Def o$[100]:istring 
Def p$[100]:istring 
Def q$[100]:istring 
Def r$[100]:istring 
    Def s$[100]:istring 
Def t$[100]:istring 
Def u$[100]:istring 
Def v$[100]:istring 
Def w$[100]:istring 
a$="CB Browser - An offline HTML browser (Freeware and Public Domain)"+"\n" 
b$=String$(49, "~")+"\n" 
c$="Written in Creative BASIC & later in Emergence BASIC.   Internet Exporer 4.0" + string$(17," ")+"\n" 
d$="is needed to run the browser program. Today's date: January 23, 2009."+"\n" 
e$=String$(49, "~")+"\n" 
f$="The CB Browser is designed as an offline HTML browser. However the program"+"\n" 
g$="also may be used as an online browser, but a user probably instead should"+"\n" 
h$="use Internet Explorer or another internet browser as their power and utility"+"\n" 
i$="overtake this simple browser. To use as an offline browser, on the command"+"\n" 
j$="command line, enter -> CBB.Exe YourHTML.Htm  If CBB.Exe is started without"+"\n" 
    k$="a HTML parameter, it will bring up search engine-> http://ixquick.com/"+"\n"  
    l$=String$(49, "~")+"\n" 
m$="To use CB Browser as an online browser: Click on the Arrow at upper right"+"\n" 
n$="to access drop down menu of websites. Click on a website and subsequently"+"\n" 
o$="click on GO. Also, a user might type in a website in the URL address bar"+"\n" 
p$="and click GO. A custom list of websites may be created by the user by"+"\n" 
q$="creating a text file, "+"\"" + "LoadURLs.Txt" + "\"" + " with Notepad. A maximum of 40 URLs."+"\n"     
    r$="Each line of LoadURLs.Txt must begin with 'http://' or 'www'."+"\n"
s$=String$(49, "~")+"\n" 
    t$=" Author: Don Smith [MarineDon]."+"\n" 
    u$=" Don's email: smithdonb@earthlink.net"+"\n" 
    v$=" Don's website: http://www.smithselfgen.com"+"\n"     
    w$=string$(49, "~")+"\n" 
    MessageBox w1,a$+b$+c$+d$+e$+f$+g$+h$+i$+j$+k$+l$+m$+n$+o$+p$+q$+r$+s$+t$+u$+v$+w$,"                             Info: CB Browser",0|32

Return 
EndSub
'===========================[SUB AdddURL]==================================== 
SUB AddURL() 
url$="" 
url$=GETCONTROLTEXT(w1,5) 
AddString w1,18,url$ 
RETURN 
EndSub
'===========================[SUB doopen]==================================== 
SUB doopen
    filename = "LoadURLs.Txt"
    xyz = 0     
    buffer = ""   
    Yesyes = 0             
    if( openfile(file1,filename,"R") = 0) 
do 
if(read(file1,ln) = 0)                 
if(len(ln) <> 0) 
                    xyz = xyz + 1   
                    if xyz = 41   
                        return
                    endif                                           
                    buffer = ln
                    buffer = url$[xyz] + "=" + buffer                                     
                    AddString w1,18,buffer                       
    endif 
            endif             
      until eof(file1)                             
closefile file1 
setcontroltext w1,1,buffer 
    Yesyes = 1 
        return 
else   
        return 
    endif         
RETURN 
EndSub



Screen Shot:
Don Smith [MarineDon]
(deceased 2011)

tbohon

Nicely done, Don ... nicely done indeed.    ;D

Tom
"If you lead your life the right way, the karma will take care of itself ... the dreams will come to you."  -- Randy Pausch, PhD (1961-2008)

Techno

Hi,

The links are broken !

LarryMc

Quote from: Techno on April 10, 2012, 02:52:10 AM
Hi,

The links are broken !

He hasn't been on in 3 years so I doubt that the links will be fixed.

LarryMc
LarryMc
Larry McCaughn :)
Author of IWB+, Custom Button Designer library, Custom Chart Designer library, Snippet Manager, IWGrid control library, LM_Image control library

GWS

Hi folks,

Here's the CBB.zip file that Don was talking about.  Never tried it myself though ..  :)

best wishes, :)

Graham
Tomorrow may be too late ..

aurelCB

Heh...
I don't see nothing extra in this browser.
Uff ,i almost forget that i create one browser with drawed toolbar(by code) oh
when i was young... ;D

look into attachment...