DonationCoder.com forum
 
Read-only archive. This is a static copy of the DonationCoder.com forum. Reading and searching work as before; logging in, posting and private messages do not.
Archive of 2026-10-21 · About this archive · Main site

Author Topic: FBSL - a simple Web browser  (Read 12,200 times)

Gerome

  • Charter Honorary Member
  • Joined in 2006
  • ***
  • Posts: 154
FBSL - a simple Web browser
« on: February 09, 2006, 10:45 PM »
Hello,

Fbsl is able to create controls on the fly thanks to its API capacity to dialog with and thanks to the rich funds that Windows has, I'll show you how easy it is to embedd a web browser component with Fbsl and thanks to ATL APIs...
Get ready... ?

At first, here's the script :
Code
'$AppType GUI
option explicit
$DLLDeclare ATL.AtlAxWinInit
Dim %hDisplay, $URL

FBSL_SetText(Me, "==FBSL Basic Web Browser==")
ReSize(Me, 0, 0, 600, 500)
Center(Me)

Const hURL = FBSL_Control("Edit", Me, "http://www.fbsl.net", 0, 10, 3, 368, 23, _
             WS_Child + WS_Visible + WS_TabStop + ES_AutoHScroll, WS_Ex_ClientEdge)
Const IDB_Go = 1000
    FBSL_Control("Button", Me, "Go", IDB_Go, 380, 3, 75, 23, WS_Child + WS_Visible + WS_TabStop, 0)
    AtlAxWinInit(0)
    hDisplay = FBSL_Control("AtlAxWin", Me, "MSHTML:<HTML></HTML>",_
                0, 0, 30, 600, 460, WS_Child + WS_Visible, WS_Ex_ClientEdge)
Show(Me)
RefreshMe()

Begin Events
    Select Case CBMsg
        Case WM_Size
            RefreshMe()
        Case WM_Close
            ExitProgram(0)
        Case WM_Command
            If CBCtl = IDB_Go Then EventGo()
    End Select
End Events

Sub EventGo()
    FBSL_GetText(hURL, URL)
    If URL = "" Then Return
    If (hDisplay <> 0) Then Destroy(hDisplay)
    hDisplay = FBSL_Control("AtlAxWin", Me, URL, 0, 0, 30, 600, 460,_
               WS_Child + WS_Visible + WS_VScroll + WS_HScroll, WS_Ex_ClientEdge)
    RefreshMe()
End Sub

Sub RefreshMe()
Dim %Lefti, %Topi, %Righti, %Bottomi
   GetClientRect( Me, Lefti, Topi, Righti, Bottomi )
   ReSize(hDisplay, 10, 30, Righti - 25, Bottomi - 70)
End Sub

And then, here's the result :
Yours,
(¯`·._.·[Gerome GUILLEMIN]·._.·´¯)
http://www.fbsl.net [FBSL Author]
http://gedd123.free.fr/FBSLv3.zip [FBSL Help file]
(¯`·._.·[If you need help... just ask]·._.·´¯)

mouser

  • First Author
  • Administrator
  • Joined in 2005
  • *****
  • Posts: 40,931
    • Gathering Badge
    • Plugin Coding Medal
    • Participated in NANY Challenge Seventeen Times
    • Cody Award
    • Coding Snacks
    • Volunteers/Staff
Re: FBSL - a simple Web browser
« Reply #1 on: February 09, 2006, 11:25 PM »
ok, that is pretty sweet.

Cpilot

  • Charter Honorary Member
  • Joined in 2006
  • ***
  • Posts: 293
    • Coding Snacks
Re: FBSL - a simple Web browser
« Reply #2 on: February 09, 2006, 11:28 PM »
Quote from: "mouser"
ok, that is pretty sweet.

Yep, api access can have it's advantages.  ;)

Cpilot

  • Charter Honorary Member
  • Joined in 2006
  • ***
  • Posts: 293
    • Coding Snacks
Re: FBSL - a simple Web browser
« Reply #3 on: February 10, 2006, 01:15 AM »
Little modification to add AutoComplete.  :)

Code
'$AppType GUI
option explicit
$DLLDeclare ATL.AtlAxWinInit,shlwapi.SHAutoComplete
Dim %hDisplay, $URL

FBSL_SetText(Me, "==FBSL Basic Web Browser==")
ReSize(Me, 0, 0, 600, 500)
Center(Me)
Const SHACF_URLMRU = &H4

Const SHACF_URLHISTORY = &H2

Const SHACF_URLALL = (SHACF_URLHISTORY + SHACF_URLMRU)
Const hURL = FBSL_Control("Edit", Me, "", 0, 10, 3, 368, 23, _
             WS_Child + WS_Visible + WS_TabStop + ES_AutoHScroll, WS_Ex_ClientEdge)
Const IDB_Go = 1000
    FBSL_Control("Button", Me, "Go", IDB_Go, 380, 3, 75, 23, WS_Child + WS_Visible + WS_TabStop, 0)
    AtlAxWinInit(0)
    hDisplay = FBSL_Control("AtlAxWin", Me, "MSHTML:<HTML></HTML>",_
                0, 0, 30, 600, 460, WS_Child + WS_Visible, WS_Ex_ClientEdge)

SHAutoComplete(hURL,SHACF_URLHISTORY)

Show(Me)
RefreshMe()

Begin Events
    Select Case CBMsg
        Case WM_Size
            RefreshMe()
        Case WM_Close
            ExitProgram(0)
        Case WM_Command
            If CBCtl = IDB_Go Then EventGo()
    End Select
End Events

Sub EventGo()
    FBSL_GetText(hURL, URL)
    If URL = "" Then Return
    If (hDisplay <> 0) Then Destroy(hDisplay)
    hDisplay = FBSL_Control("AtlAxWin", Me, URL, 0, 0, 30, 600, 460,_
               WS_Child + WS_Visible + WS_VScroll + WS_HScroll, WS_Ex_ClientEdge)
    RefreshMe()
End Sub

Sub RefreshMe()
Dim %Lefti, %Topi, %Righti, %Bottomi
   GetClientRect( Me, Lefti, Topi, Righti, Bottomi )
   ReSize(hDisplay, 10, 30, Righti - 25, Bottomi - 70)
End Sub

Gerome

  • Charter Honorary Member
  • Joined in 2006
  • ***
  • Posts: 154
Re: FBSL - a simple Web browser
« Reply #4 on: February 10, 2006, 10:39 AM »
Yo Cpilot!

Even better!
Now i'm using your version at office, this helps me a lot at debugging my JScript code compared to a direct use of complete IE6 where it by default mask all JScripts errors (even if the check was checked!).
Anyway, your enhanced version is more practical ;)
Yours,
(¯`·._.·[Gerome GUILLEMIN]·._.·´¯)
http://www.fbsl.net [FBSL Author]
http://gedd123.free.fr/FBSLv3.zip [FBSL Help file]
(¯`·._.·[If you need help... just ask]·._.·´¯)

Gerome

  • Charter Honorary Member
  • Joined in 2006
  • ***
  • Posts: 154
Re: FBSL - a simple Web browser
« Reply #5 on: February 10, 2006, 11:03 AM »
Hello,

I've refined the code and fixed 2 bugs, one of the 2 bugs was sucking RAM :)
Enjoy this smoother version :=)

Code
'$AppType GUI
option explicit
$DLLDeclare ATL.AtlAxWinInit,shlwapi.SHAutoComplete
Dim %hDisplay, $URL

FBSL_SetText(Me, "==FBSL Basic Web Browser==")
ReSize(Me, 0, 0, 600, 500)
Center(Me)
Const SHACF_URLMRU = &H4

Const SHACF_URLHISTORY = &H2

Const SHACF_URLALL = (SHACF_URLHISTORY + SHACF_URLMRU)
Const hURL = FBSL_Control("Edit", Me, "", 0, 10, 3, 368, 23, _
             WS_Child + WS_Visible + WS_TabStop + ES_AutoHScroll, WS_Ex_ClientEdge)
Const IDB_Go = 1000
    FBSL_Control("Button", Me, "Go", IDB_Go, 380, 3, 75, 23, WS_Child + WS_Visible + WS_TabStop, 0)
    AtlAxWinInit(0)
    hDisplay = FBSL_Control("AtlAxWin", Me, "MSHTML:<HTML></HTML>",_
                0, 0, 30, 600, 460, WS_Child + WS_Visible, WS_Ex_ClientEdge)

SHAutoComplete(hURL,SHACF_URLHISTORY)

Show(Me)
RefreshMe()

Begin Events
    Select Case CBMsg
        Case WM_Size
            RefreshMe()
        Case WM_Close
            ExitProgram(0)
        Case WM_Command
            If CBCtl = IDB_Go Then EventGo()
    End Select
End Events

Sub EventGo()
    FBSL_GetText(hURL, URL)
    If (hDisplay <> 0) Then
        Destroy(hDisplay)
        hDisplay = 0
    End If
    If URL = "" Then Exit Sub
    hDisplay = FBSL_Control("AtlAxWin", Me, URL, 0, 0, 30, 600, 460,_
               WS_Child + WS_Visible + WS_VScroll + WS_HScroll, WS_Ex_ClientEdge)
    RefreshMe()
End Sub

Sub RefreshMe()
Dim %Lefti, %Topi, %Righti, %Bottomi
   GetClientRect( Me, Lefti, Topi, Righti, Bottomi )
   ReSize(hDisplay, 10, 30, Righti - 25, Bottomi - 70)
End Sub
Yours,
(¯`·._.·[Gerome GUILLEMIN]·._.·´¯)
http://www.fbsl.net [FBSL Author]
http://gedd123.free.fr/FBSLv3.zip [FBSL Help file]
(¯`·._.·[If you need help... just ask]·._.·´¯)

Original address: https://www.donationcoder.com/forum/index.php?topic=2392.0