Hello,
A simple web browser with a mutex that allows to execute more than one instance at a time
#Option Explicit
#DllDeclare atl.AtlAxWinInit
Dim %hMutex, $URL, %hDisplay
' // Create a Mutex : only ONE instance is allowed !!
hMutex = ApiCall("CreateMutex", "kernel32", 0, 1, "__MUTEX__Browser__")
If GetLastError() = 183 Then ExitProgram(-1)
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