ATTENTION: You are viewing a page formatted for mobile devices; to view the full web page, click HERE.

Other Software > Developer's Corner

FBSL - a simple Web browser

(1/2) > >>

Gerome:
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 :

--- ---'$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 :

mouser:
ok, that is pretty sweet.

Cpilot:
ok, that is pretty sweet.-mouser
--- End quote ---

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

Cpilot:
Little modification to add AutoComplete.  :)


--- ---'$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:
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 ;)

Navigation

[0] Message Index

[#] Next page

Go to full version