Oxygen Basic
Programming => Example Code => Utility => Topic started by: Aurel on April 21, 2013, 05:36:46 AM
-
in most of compilers / interpreters examples one of the example is how create simple Web Browser.
(Even my crappy Aurel Basic can build Web Browser ;D)..
Charles...
I have found in freeBasic examples folder called 'Web browser' and i try to compile some of
examples inside this folder in hope that i can translate code to Oxygen.
BUT no one of this programs wont compile or run ???
So i ask you do you can try compile this programs on your computer ???
that we can see is this even works ... ???
looks very strange to me that no one of examples don't respond ::)
-
Ah yes I remember that one from long ago. I see it uses 13 files, no less! It will be good to extract the essentials of this example. I am sure it can be greatly simplified.
-
Do you can try this Charles?
Because i don't get it why don't compile on my comp ::)
-
This (http://www.tecgraf.puc-rio.br/iup/en/ctrl/iupweb.html) may be helpful and a working example (http://www.allbasic.info/forum/index.php?topic=180.msg2366#msg2366) in BaCon.
-
No John..
I need something like in FB example with win api not from iup,webkit...etc..
it just complicate things.
I will search more ..maybe i found direct example from C/C++..
-
I'm sure there are plenty of wrapper examples out there doing the (only) same thing IUP is doing. Unless you know of some other solution for a ATL based COM container for the MS web browser control, I'm all ears.
I know of this guy down the street that is looking for help building his house. The only requirement is NO power tools allowed and all materials are crafted from rough cut lumber and river rock. You seem like the kind of guy that would be perfect for the job.
-
But why use something if we can use something from api directly?
I have found few examples in C++ (WebForm)...etc
if i ever want use external lib than i will look into gecko by mozzila...
-
This may be helpful and a working example (http://www.allbasic.info/mboard/index.php?topic=501.msg1351#msg1351) in FreeBasic. I did this some time ago so things may have changed with the API since.
-
john..
is this thinBasic example or powerbasic example?
looks good ;)
i have found something with mshtml.dll but i must first modify include that work with oxygen...
-
That is a FreeBasic example (Tiny Browser) running under Wine. (period of my life transitioning to Linux)
If my memory serves me correctly I found a bug compiling the Tiny Browser example that CountingPine (Mathew) resolved. Once again, many moons ago ...
-
Most promising source reference I've seen so far:
http://www.jose.it-berater.org/smfforum/index.php?board=421.0
-
I am working as basis with this webbrowser (as mentioned before from charles with the link above) from jose for my funbasic project (funbasicz_editor). that looks like this one.
I am not ready to convert all features from pbwin to oxygen yet. but for studying source it may help you aurel with some ideas.
regards, frank
X
-
Thanks ..
I already look inro jose forum and see this examples...
so it looks that we need CWindow.inc for this browser example..
Looks complicating but maybe is not that much... :-\
-
Hmm..i don't have powerBasic but some of you have..
Maybe frank can show as how looks this examples in screenshots that we can see
what is what here... ::)
-
I am not sure if will work but i think that is worth to try.
found simple webcontrol by Jeff Glatt for mingW example with source code and
one small dll 3.5kB...
-
Jeff Glatt. Excellent info.
http://www.codeproject.com/Articles/3365/Embed-an-HTML-control-in-your-own-window-using-pla
-
Charles,
Can I use this example with DLLC?
Since I'm already committed to IUP, is using their web browser control a better path for me to follow?
Either way the source is very well documented and worth the peek.
John
-
Hi John, Hooking up a web browser object directly in COM is complex. So, if you are committed to IUP then let it do all the work for you.
-
I have to agree. Getting the IUP web control working in BaCon was a breeze. I don't see Windows being an obstacle.
(http://files.allbasic.info/BaCon/iup_web.png)
' IupWebBrowser sample
PRAGMA OPTIONS -I/usr/include/iup
PRAGMA LDFLAGS iup iupweb
PRAGMA INCLUDE iup.h iupweb.h
PROTO IupOpen IupWebBrowserOpen IupSetAttribute IupSetAttributeHandle IupSetCallback IupShow IupMainLoop IupClose
DECLARE web TYPE Ihandle*
DECLARE txt TYPE Ihandle*
DECLARE dlg TYPE Ihandle*
DECLARE btLoad TYPE Ihandle*
DECLARE btReload TYPE Ihandle*
DECLARE btBack TYPE Ihandle*
DECLARE btForward TYPE Ihandle*
DECLARE btStop TYPE Ihandle*
DECLARE self TYPE Ihandle*
DECLARE url TYPE STRING
FUNCTION navigate_cb(Ihandle* self, STRING url)
PRINT "NAVIGATE_CB: ", url
self = NULL
IF INSTR(url, "download") THEN
RETURN IUP_IGNORE
ELSE
RETURN IUP_DEFAULT
END IF
END FUNCTION
FUNCTION error_cb(Ihandle* self, STRING url)
PRINT "ERROR_CB: ", url
self = NULL
RETURN IUP_DEFAULT
END FUNCTION
FUNCTION completed_cb(Ihandle* self, STRING url)
PRINT "COMPLETED_CB: ", url
self = NULL
RETURN IUP_DEFAULT
END FUNCTION
FUNCTION newwindow_cb(Ihandle* self, STRING url)
PRINT "NEWWINDOW_CB: ", url
IupSetAttribute(self, "VALUE", url)
RETURN IUP_DEFAULT
END FUNCTION
FUNCTION back_cb(Ihandle* self)
web = (Ihandle*)IupGetAttribute(self, "MY_WEB")
IupSetAttribute(web, "BACKFORWARD", "-1")
RETURN IUP_DEFAULT
END FUNCTION
FUNCTION forward_cb(Ihandle* self)
web = (Ihandle*)IupGetAttribute(self, "MY_WEB")
IupSetAttribute(web, "BACKFORWARD", "1")
RETURN IUP_DEFAULT
END FUNCTION
FUNCTION stop_cb(Ihandle* self)
web = (Ihandle*)IupGetAttribute(self, "MY_WEB")
IupSetAttribute(web, "STOP", NULL)
RETURN IUP_DEFAULT
END FUNCTION
FUNCTION reload_cb(Ihandle* self)
web = (Ihandle*)IupGetAttribute(self, "MY_WEB")
IupSetAttribute(web, "RELOAD", NULL)
' TEST:
' PRINT "STATUS=", IupGetAttribute(web, "STATUS")
RETURN IUP_DEFAULT
END FUNCTION
FUNCTION load_cb(Ihandle* self)
txt = (Ihandle*)IupGetAttribute(self, "MY_TEXT")
web = (Ihandle*)IupGetAttribute(self, "MY_WEB")
IupSetAttribute(web, "VALUE", IupGetAttribute(txt, "VALUE"))
' TESTS:
' IupSetAttribute(txt, "VALUE", IupGetAttribute(web, "VALUE"))
' IupSetAttribute(web, "HTML", "<html><body><b>Hello</b>, World!</body></html>")
' IupSetAttribute(web, "VALUE", "http://www.microsoft.com")
RETURN IUP_DEFAULT
END FUNCTION
IupOpen(NULL, NULL)
IupWebBrowserOpen()
' Creates an instance of the WebBrowser control
web = IupWebBrowser()
' Creates a dialog containing the control
dlg = IupDialog(IupVbox(IupHbox(btBack = IupButton("Back", NULL), \
btForward = IupButton("Forward", NULL), \
txt = IupText(""), \
btLoad = IupButton("Load", NULL), \
btReload = IupButton("Reload", NULL), \
btStop = IupButton("Stop", NULL), \
NULL), \
web, NULL))
IupSetAttribute(dlg, "TITLE", "IupWebBrowser")
IupSetAttribute(dlg, "MY_TEXT", (STRING)txt)
IupSetAttribute(dlg, "MY_WEB", (STRING)web)
IupSetAttribute(dlg, "RASTERSIZE", "800x600")
IupSetAttribute(dlg, "MARGIN", "10x10")
IupSetAttribute(dlg, "GAP", "10")
' IupSetAttribute(web, "HTML", "<html><body><b>Hello</b>World!</body></html>")
' IupSetAttribute(txt, "VALUE", "My HTML")
' IupSetAttribute(txt, "VALUE", "file:///D:/tecgraf/iup/html/index.html")
IupSetAttribute(txt, "VALUE", "http://www.basic-converter.org/")
IupSetAttribute(web, "VALUE", IupGetAttribute(txt, "VALUE"))
IupSetAttributeHandle(dlg, "DEFAULTENTER", btLoad)
IupSetAttribute(txt, "EXPAND", "HORIZONTAL")
IupSetCallback(btLoad, "ACTION", (Icallback)load_cb)
IupSetCallback(btReload, "ACTION", (Icallback)reload_cb)
IupSetCallback(btBack, "ACTION", (Icallback)back_cb)
IupSetCallback(btForward, "ACTION", (Icallback)forward_cb)
IupSetCallback(btStop, "ACTION", (Icallback)stop_cb)
IupSetCallback(web, "NEWWINDOW_CB", (Icallback)newwindow_cb)
IupSetCallback(web, "NAVIGATE_CB", (Icallback)navigate_cb)
IupSetCallback(web, "ERROR_CB", (Icallback)error_cb)
IupSetCallback(web, "COMPLETED_CB", (Icallback)completed_cb)
IupShow(dlg)
IupMainLoop()
IupClose()
-
I already look inro jose forum and see this examples...
so it looks that we need CWindow.inc for this browser example..
Looks complicating but maybe is not that much...
@aurel: I am at work and have no example by hand, but it's not true that you need cWindow include files for running "webbrowser" example. I wrote my editor over one and a half year before jose adepted his great webbrowser onto "cWindow.inc" basis and I am using usual win api (sdk) features for it.
I will see what I can convert or show next days. how often you need only a little portion from powerbasic to oxygenbasic for runing and that's funny for me how that's working and running here fine ;)
servus, frank
-
Ok Frank...i will wait for your way from Power Basic..
And yes Charles have a right about using COM into app ,but many other languages have this
because are created with C++ and use static libs and com templates, but this is not case here...
i will see what i can with this small .dll and try to create browser.
-
Charles...
How i can translate this code to oxygen, i mean do i can translate this like functions
typedef long WINAPI EmbedBrowserObjectPtr(HWND);
typedef long WINAPI UnEmbedBrowserObjectPtr(HWND);
typedef long WINAPI DisplayHTMLPagePtr(HWND, LPCTSTR);
typedef long WINAPI DisplayHTMLStrPtr(HWND, LPCTSTR);
-
Possibly:
% WINAPI
typedef sys HWND
typedef char* LPCTSTR
typedef sys WINAPI EmbedBrowserObjectPtr(HWND);
typedef sys WINAPI UnEmbedBrowserObjectPtr(HWND);
typedef sys WINAPI DisplayHTMLPagePtr(HWND, LPCTSTR);
typedef sys WINAPI DisplayHTMLStrPtr(HWND, LPCTSTR);
-
for aurel: Here's a little code portion for url using from powerbasic site what I have found on my hd. perhaps it can help you, but you have still to convert that for oxygen.
%IDC_STATUSBAR = 1001
%IDC_REBAR = 1002
%IDC_SCIED = 1003
%IDC_TOOLBAR = 1004
%IDC_EDITURL = 1005
%IDC_GOBTN = 1006
insert below wndproc... (callback) ..
'--------------- 1 -------------------------------- //
...
LOCAL trbi AS REBARINFO ' specifies attributes(imagelist) of the rebar control
LOCAL trbbi AS REBARBANDINFO ' specifies or receives the attributes of a rebar band
...
'--------------- 2 -------------------------------- //
CASE %WM_COMMAND
...
CASE %IDOK
' If we are in the URL edit control, load the web page
hCtrl = GetDlgItem(GetDlgItem(hWnd, %IDC_REBAR), %IDC_EDITURL)
IF GetFocus = hCtrl THEN
PostMessage hWnd, %WM_COMMAND, %IDC_GOBTN, MAK(DWORD, %BN_CLICKED, %IDC_GOBTN)
EXIT FUNCTION
END IF
CASE %IDC_EDITURL
SELECT CASE HI(WORD, wParam)
CASE %EN_SETFOCUS
' Select all the text of the edit box
PostMessage lParam, %EM_SETSEL, 0, -1
EXIT FUNCTION
END SELECT
'--------------- 3 -------------------------------- //
' Create the EditUrl edit control
hCtrl = CreateWindowEx(%WS_EX_CLIENTEDGE, _ ' extended styles
"Edit", _ ' class name
"", _ ' caption
%WS_CHILD OR %WS_VISIBLE OR %WS_TABSTOP OR _ ' window styles
%ES_LEFT OR %ES_AUTOHSCROLL, _ ' class styles
251, 4, _ ' left, top
300, 21, _ ' width, height
hWnd, %IDC_EDITURL, _ ' handle of parent, control ID
GetModuleHandle(""), BYVAL %NULL) ' handle of instance, creation parameters
SendMessage hCtrl, %WM_SETFONT, hFont, %TRUE
' Add the band containing the EditUrl edit control to the rebar
szItem = "URL"
trbbi.cbSize = SIZEOF(trbbi)
trbbi.fMask = %RBBIM_STYLE OR %RBBIM_TEXT OR %RBBIM_CHILD OR _
%RBBIM_CHILDSIZE OR %RBBIM_SIZE OR %RBBIM_ID OR _
%RBBIM_IDEALSIZE
trbbi.fStyle = %RBBS_FIXEDSIZE OR %RBBS_CHILDEDGE
trbbi.lpText = VARPTR(szItem)
trbbi.hWndChild = hCtrl
trbbi.cxMinChild = 350
trbbi.cyMinChild = 21
trbbi.cx = 350
trbbi.wID = %IDS_STRING1
trbbi.cxIdeal = 350
SendMessage hWndRebar, %RB_INSERTBAND, -1, BYVAL VARPTR(trbbi)
' Create the GoBtn text button
hCtrl = CreateWindowEx(%NULL, _ ' extended styles
"Button", _ ' class name
"Go_SCI", _ ' caption
%WS_CHILD OR %WS_VISIBLE OR %WS_TABSTOP OR _ ' window styles
%BS_PUSHBUTTON OR %BS_CENTER OR %BS_VCENTER OR _ ' class styles
%BS_FLAT, _
593, 2, _ ' left, top
64, 24, _ ' width, height
hWnd, %IDC_GOBTN, _ ' handle of parent, control ID
GetModuleHandle(""), BYVAL %NULL) ' handle of instance, creation parameters
SendMessage hCtrl, %WM_SETFONT, hFont, %TRUE
' Add the band containing the GoBtn text button to the rebar
trbbi.cbSize = SIZEOF(trbbi)
trbbi.fMask = %RBBIM_STYLE OR %RBBIM_CHILD OR %RBBIM_CHILDSIZE OR _
%RBBIM_SIZE OR %RBBIM_ID OR %RBBIM_IDEALSIZE
trbbi.fStyle = %RBBS_FIXEDSIZE OR %RBBS_CHILDEDGE
trbbi.hWndChild = hCtrl
trbbi.cxMinChild = 34
trbbi.cyMinChild = 24
trbbi.cx = 34
trbbi.wID = %IDS_STRING2
trbbi.cxIdeal = 34
SendMessage hWndRebar, %RB_INSERTBAND, -1, BYVAL VARPTR(trbbi)
best regards, frank
-
hi frank..
but this code only have
rebar control
edit control and
GoBuuton
there is no nothing like html control ???
-
sorry, have had wrong file to copy...
take that one:
'' commctrl.inc
%RB_INSERTBAND = (%WM_USER + 1)
' // Size = 12 bytes
TYPE REBARINFO DWORD
cbSize AS DWORD ' UINT cbSize
fMask AS DWORD ' UINT fMask
himl AS DWORD ' HIMAGELIST himl
END TYPE
TYPE REBARBANDINFOA
cbSize AS DWORD
fMask AS DWORD
fStyle AS DWORD
clrFore AS DWORD
clrBack AS DWORD
lpText AS ASCIIZ PTR
cch AS DWORD
iImage AS LONG
hwndChild AS DWORD
cxMinChild AS DWORD
cyMinChild AS DWORD
cx AS DWORD
hbmBack AS DWORD
wID AS DWORD
#IF (%WIN32_IE >= &H0400)
cyChild AS DWORD
cyMaxChild AS DWORD
cyIntegral AS DWORD
cxIdeal AS DWORD
lParam AS LONG
cxHeader AS DWORD
#ENDIF
#IF (%WIN32_WINNT >= &H0600)
rcChevronLocation AS RECT ' the rect is in client co-ord wrt hwndChild
uChevronState AS DWORD ' STATE_SYSTEM_*
#ENDIF
END TYPE
TYPE REBARBANDINFOW
cbSize AS DWORD
fMask AS DWORD
fStyle AS DWORD
clrFore AS DWORD
clrBack AS DWORD
lpText AS WSTRINGZ PTR
cch AS DWORD
iImage AS LONG
hwndChild AS DWORD
cxMinChild AS DWORD
cyMinChild AS DWORD
cx AS DWORD
hbmBack AS DWORD
wID AS DWORD
#IF (%WIN32_IE >= &H0400)
cyChild AS DWORD
cyMaxChild AS DWORD
cyIntegral AS DWORD
cxIdeal AS DWORD
lParam AS LONG
cxHeader AS DWORD
#ENDIF
#IF (%WIN32_WINNT >= &H0600)
rcChevronLocation AS RECT ' the rect is in client co-ord wrt hwndChild
uChevronState AS DWORD ' STATE_SYSTEM_*
#ENDIF
END TYPE
%IDC_STATUSBAR = 1001
%IDC_REBAR = 1002
%IDC_SCIED = 1003
%IDC_TOOLBAR = 1004
%IDC_EDITURL = 1005
%IDC_GOBTN = 1006
'--------------- 1 -------------------------------- //
...
LOCAL trbi AS REBARINFO ' specifies attributes(imagelist) of the rebar control
LOCAL trbbi AS REBARBANDINFO ' specifies or receives the attributes of a rebar band
...
'--------------- 2 -------------------------------- //
CASE %WM_COMMAND
...
CASE %IDOK
' If we are in the URL edit control, load the web page
hCtrl = GetDlgItem(GetDlgItem(hWnd, %IDC_REBAR), %IDC_EDITURL)
IF GetFocus = hCtrl THEN
PostMessage hWnd, %WM_COMMAND, %IDC_GOBTN, MAK(DWORD, %BN_CLICKED, %IDC_GOBTN)
EXIT FUNCTION
END IF
CASE %IDC_EDITURL
SELECT CASE HI(WORD, wParam)
CASE %EN_SETFOCUS
' Select all the text of the edit box
PostMessage lParam, %EM_SETSEL, 0, -1
EXIT FUNCTION
END SELECT
'--------------- 3 -------------------------------- //
' Create the EditUrl edit control
hCtrl = CreateWindowEx(%WS_EX_CLIENTEDGE, _ ' extended styles
"Edit", _ ' class name
"", _ ' caption
%WS_CHILD OR %WS_VISIBLE OR %WS_TABSTOP OR _ ' window styles
%ES_LEFT OR %ES_AUTOHSCROLL, _ ' class styles
251, 4, _ ' left, top
300, 21, _ ' width, height
hWnd, %IDC_EDITURL, _ ' handle of parent, control ID
GetModuleHandle(""), BYVAL %NULL) ' handle of instance, creation parameters
SendMessage hCtrl, %WM_SETFONT, hFont, %TRUE
'SetWindowText hCtrl, "http://www.oxygenbasic.org/forum"
' Add the band containing the EditUrl edit control to the rebar
szItem = "URL"
trbbi.cbSize = SIZEOF(trbbi)
trbbi.fMask = %RBBIM_STYLE OR %RBBIM_TEXT OR %RBBIM_CHILD OR _
%RBBIM_CHILDSIZE OR %RBBIM_SIZE OR %RBBIM_ID OR _
%RBBIM_IDEALSIZE
trbbi.fStyle = %RBBS_FIXEDSIZE OR %RBBS_CHILDEDGE
trbbi.lpText = VARPTR(szItem)
trbbi.hWndChild = hCtrl
trbbi.cxMinChild = 350
trbbi.cyMinChild = 21
trbbi.cx = 350
trbbi.wID = %IDS_STRING1
trbbi.cxIdeal = 350
SendMessage hWndRebar, %RB_INSERTBAND, -1, BYVAL VARPTR(trbbi)
' Create the GoBtn text button
hCtrl = CreateWindowEx(%NULL, _ ' extended styles
"Button", _ ' class name
"Go_SCI", _ ' caption
%WS_CHILD OR %WS_VISIBLE OR %WS_TABSTOP OR _ ' window styles
%BS_PUSHBUTTON OR %BS_CENTER OR %BS_VCENTER OR _ ' class styles
%BS_FLAT, _
593, 2, _ ' left, top
64, 24, _ ' width, height
hWnd, %IDC_GOBTN, _ ' handle of parent, control ID
GetModuleHandle(""), BYVAL %NULL) ' handle of instance, creation parameters
SendMessage hCtrl, %WM_SETFONT, hFont, %TRUE
' Add the band containing the GoBtn text button to the rebar
trbbi.cbSize = SIZEOF(trbbi)
trbbi.fMask = %RBBIM_STYLE OR %RBBIM_CHILD OR %RBBIM_CHILDSIZE OR _
%RBBIM_SIZE OR %RBBIM_ID OR %RBBIM_IDEALSIZE
trbbi.fStyle = %RBBS_FIXEDSIZE OR %RBBS_CHILDEDGE
trbbi.hWndChild = hCtrl
trbbi.cxMinChild = 34
trbbi.cyMinChild = 24
trbbi.cx = 34
trbbi.wID = %IDS_STRING2
trbbi.cxIdeal = 34
SendMessage hWndRebar, %RB_INSERTBAND, -1, BYVAL VARPTR(trbbi)
...
FUNCTION MdiWindowProc (BYVAL hWnd AS DWORD, BYVAL wMsg AS DWORD, _
BYVAL wParam AS DWORD, BYVAL lParam AS LONG) AS LONG
LOCAL hr AS LONG
LOCAL nTab AS LONG
LOCAL rc AS RECT
LOCAL szText AS ASCIIZ * 255
LOCAL hWB AS DWORD
LOCAL pIWebBrowser2 AS IWebBrowser2
' LOCAL pWBEvents AS DWebBrowserEvents2Impl
LOCAL dwCookie AS DWORD
SELECT CASE wMsg
CASE %WM_CREATE
GetClientRect hWnd, rc
' Increase the tab number and set the caption
hWB = CreateWebBrowser(hWnd) 'creates new window with tabs
' Insert new tab
nTab = SendMessage(ghTabMdi, %TCM_GETITEMCOUNT, 0, 0)
szText = FORMAT$(nTab + 1, "000")
SetWindowText(hWnd, szText)
InsertTabMdiItem(ghTabMdi, nTab + 1, szText)
' Set it as the current selection on the tab control
SendMessage(ghTabMdi, %TCM_SETCURSEL, nTab, 0)
CASE %WM_SIZE
MoveWindow GetDlgItem(hWnd, %IDC_EDIT), 0, 0, LOWRD(lParam), HIWRD(lParam), %TRUE
MoveWindow GetDlgItem(hWnd, %IDC_SCIEDIT), 0, 0, LOWRD(lParam), HIWRD(lParam), %TRUE
CASE %WM_SETFOCUS
SetFocus GetActiveWbWindow
CASE %WM_MDIACTIVATE
' Using handle, get associated tab via caption string
' Get the caption text of the window
GetWindowText(lParam, szText, %MAX_PATH)
' Find the associated tab and activate it
EnumMdiTitleToTab(szText)
SetFocus GetActiveWbWindow
CASE %WM_DESTROY
' Get the handle of the window that hosts the control
hWB = GetDlgItem(hWnd, %IDC_EDIT)
' Disconnect events and remove property
' Remove Tab associated with this window
GetWindowText(hWnd, szText, SIZEOF(szText))
nTab = EnumMdiTitleToTabRemove(szText)
END SELECT
FUNCTION = DefMDIChildProc(hWnd, wMsg, wParam, lParam)
END FUNCTION
the rebar feature you don't need I think and the "commctrl.inc" should be important for you but I didn't know if that's allowed without legacy to copy or use it from jose's website or powerbasic incorporation, better to ask if you are using it or/and working with it ;)
best regards, frank
-
hWB = CreateWebBrowser(hWnd) 'creates new window with tabs
frank this part is important, and i probably part of comctrl.inc
for which i dont see why be limited to use if is part of JoseRoca headers
or maybe im wrong about JoseRoca headers... ::)
-
hWB = CreateWebBrowser(hWnd) 'creates new window with tabs
look at the last part of this example aurel, you can see it's just a function (createwebbrowser), but you have to create an own class for it and in codeproc a new scintilla control, that's all ;) this code part comes from jose's first webbrowser example it didn't work at that time with cWindows.inc. I can only say thank him for that great work. I hope the code part below can help you.
%RB_INSERTBAND = (%WM_USER + 1)
' // Size = 12 bytes
TYPE REBARINFO DWORD
cbSize AS DWORD ' UINT cbSize
fMask AS DWORD ' UINT fMask
himl AS DWORD ' HIMAGELIST himl
END TYPE
TYPE REBARBANDINFOA
cbSize AS DWORD
fMask AS DWORD
fStyle AS DWORD
clrFore AS DWORD
clrBack AS DWORD
lpText AS ASCIIZ PTR
cch AS DWORD
iImage AS LONG
hwndChild AS DWORD
cxMinChild AS DWORD
cyMinChild AS DWORD
cx AS DWORD
hbmBack AS DWORD
wID AS DWORD
#IF (%WIN32_IE >= &H0400)
cyChild AS DWORD
cyMaxChild AS DWORD
cyIntegral AS DWORD
cxIdeal AS DWORD
lParam AS LONG
cxHeader AS DWORD
#ENDIF
#IF (%WIN32_WINNT >= &H0600)
rcChevronLocation AS RECT ' the rect is in client co-ord wrt hwndChild
uChevronState AS DWORD ' STATE_SYSTEM_*
#ENDIF
END TYPE
TYPE REBARBANDINFOW
cbSize AS DWORD
fMask AS DWORD
fStyle AS DWORD
clrFore AS DWORD
clrBack AS DWORD
lpText AS WSTRINGZ PTR
cch AS DWORD
iImage AS LONG
hwndChild AS DWORD
cxMinChild AS DWORD
cyMinChild AS DWORD
cx AS DWORD
hbmBack AS DWORD
wID AS DWORD
#IF (%WIN32_IE >= &H0400)
cyChild AS DWORD
cyMaxChild AS DWORD
cyIntegral AS DWORD
cxIdeal AS DWORD
lParam AS LONG
cxHeader AS DWORD
#ENDIF
#IF (%WIN32_WINNT >= &H0600)
rcChevronLocation AS RECT ' the rect is in client co-ord wrt hwndChild
uChevronState AS DWORD ' STATE_SYSTEM_*
#ENDIF
END TYPE
%IDC_STATUSBAR = 1001
%IDC_REBAR = 1002
%IDC_SCIED = 1003
%IDC_TOOLBAR = 1004
%IDC_EDITURL = 1005
%IDC_GOBTN = 1006
'--------------- 1 -------------------------------- //
...
LOCAL trbi AS REBARINFO ' specifies attributes(imagelist) of the rebar control
LOCAL trbbi AS REBARBANDINFO ' specifies or receives the attributes of a rebar band
...
'--------------- 2 -------------------------------- //
CASE %WM_COMMAND
...
CASE %IDOK
' If we are in the URL edit control, load the web page
hCtrl = GetDlgItem(GetDlgItem(hWnd, %IDC_REBAR), %IDC_EDITURL)
IF GetFocus = hCtrl THEN
PostMessage hWnd, %WM_COMMAND, %IDC_GOBTN, MAK(DWORD, %BN_CLICKED, %IDC_GOBTN)
EXIT FUNCTION
END IF
CASE %IDC_EDITURL
SELECT CASE HI(WORD, wParam)
CASE %EN_SETFOCUS
' Select all the text of the edit box
PostMessage lParam, %EM_SETSEL, 0, -1
EXIT FUNCTION
END SELECT
'--------------- 3 -------------------------------- //
' Create the EditUrl edit control
hCtrl = CreateWindowEx(%WS_EX_CLIENTEDGE, _ ' extended styles
"Edit", _ ' class name
"", _ ' caption
%WS_CHILD OR %WS_VISIBLE OR %WS_TABSTOP OR _ ' window styles
%ES_LEFT OR %ES_AUTOHSCROLL, _ ' class styles
251, 4, _ ' left, top
300, 21, _ ' width, height
hWnd, %IDC_EDITURL, _ ' handle of parent, control ID
GetModuleHandle(""), BYVAL %NULL) ' handle of instance, creation parameters
SendMessage hCtrl, %WM_SETFONT, hFont, %TRUE
'SetWindowText hCtrl, "http://www.oxygenbasic.org/forum"
' Add the band containing the EditUrl edit control to the rebar
szItem = "URL"
trbbi.cbSize = SIZEOF(trbbi)
trbbi.fMask = %RBBIM_STYLE OR %RBBIM_TEXT OR %RBBIM_CHILD OR _
%RBBIM_CHILDSIZE OR %RBBIM_SIZE OR %RBBIM_ID OR _
%RBBIM_IDEALSIZE
trbbi.fStyle = %RBBS_FIXEDSIZE OR %RBBS_CHILDEDGE
trbbi.lpText = VARPTR(szItem)
trbbi.hWndChild = hCtrl
trbbi.cxMinChild = 350
trbbi.cyMinChild = 21
trbbi.cx = 350
trbbi.wID = %IDS_STRING1
trbbi.cxIdeal = 350
SendMessage hWndRebar, %RB_INSERTBAND, -1, BYVAL VARPTR(trbbi)
' Create the GoBtn text button
hCtrl = CreateWindowEx(%NULL, _ ' extended styles
"Button", _ ' class name
"Go_SCI", _ ' caption
%WS_CHILD OR %WS_VISIBLE OR %WS_TABSTOP OR _ ' window styles
%BS_PUSHBUTTON OR %BS_CENTER OR %BS_VCENTER OR _ ' class styles
%BS_FLAT, _
593, 2, _ ' left, top
64, 24, _ ' width, height
hWnd, %IDC_GOBTN, _ ' handle of parent, control ID
GetModuleHandle(""), BYVAL %NULL) ' handle of instance, creation parameters
SendMessage hCtrl, %WM_SETFONT, hFont, %TRUE
' Add the band containing the GoBtn text button to the rebar
trbbi.cbSize = SIZEOF(trbbi)
trbbi.fMask = %RBBIM_STYLE OR %RBBIM_CHILD OR %RBBIM_CHILDSIZE OR _
%RBBIM_SIZE OR %RBBIM_ID OR %RBBIM_IDEALSIZE
trbbi.fStyle = %RBBS_FIXEDSIZE OR %RBBS_CHILDEDGE
trbbi.hWndChild = hCtrl
trbbi.cxMinChild = 34
trbbi.cyMinChild = 24
trbbi.cx = 34
trbbi.wID = %IDS_STRING2
trbbi.cxIdeal = 34
SendMessage hWndRebar, %RB_INSERTBAND, -1, BYVAL VARPTR(trbbi)
...
FUNCTION MdiWindowProc (BYVAL hWnd AS DWORD, BYVAL wMsg AS DWORD, _
BYVAL wParam AS DWORD, BYVAL lParam AS LONG) AS LONG
LOCAL hr AS LONG
LOCAL nTab AS LONG
LOCAL rc AS RECT
LOCAL szText AS ASCIIZ * 255
LOCAL hWB AS DWORD
LOCAL pIWebBrowser2 AS IWebBrowser2
' LOCAL pWBEvents AS DWebBrowserEvents2Impl
LOCAL dwCookie AS DWORD
SELECT CASE wMsg
CASE %WM_CREATE
GetClientRect hWnd, rc
' Increase the tab number and set the caption
hWB = CreateWebBrowser(hWnd) 'creates new window with tabs
' Insert new tab
nTab = SendMessage(ghTabMdi, %TCM_GETITEMCOUNT, 0, 0)
szText = FORMAT$(nTab + 1, "000")
SetWindowText(hWnd, szText)
InsertTabMdiItem(ghTabMdi, nTab + 1, szText)
' Set it as the current selection on the tab control
SendMessage(ghTabMdi, %TCM_SETCURSEL, nTab, 0)
CASE %WM_SIZE
MoveWindow GetDlgItem(hWnd, %IDC_EDIT), 0, 0, LOWRD(lParam), HIWRD(lParam), %TRUE
MoveWindow GetDlgItem(hWnd, %IDC_SCIEDIT), 0, 0, LOWRD(lParam), HIWRD(lParam), %TRUE
CASE %WM_SETFOCUS
SetFocus GetActiveWbWindow
CASE %WM_MDIACTIVATE
' Using handle, get associated tab via caption string
' Get the caption text of the window
GetWindowText(lParam, szText, %MAX_PATH)
' Find the associated tab and activate it
EnumMdiTitleToTab(szText)
SetFocus GetActiveWbWindow
CASE %WM_DESTROY
' Get the handle of the window that hosts the control
hWB = GetDlgItem(hWnd, %IDC_EDIT)
' Disconnect events and remove property
' Remove Tab associated with this window
GetWindowText(hWnd, szText, SIZEOF(szText))
nTab = EnumMdiTitleToTabRemove(szText)
END SELECT
FUNCTION = DefMDIChildProc(hWnd, wMsg, wParam, lParam)
END FUNCTION
$PBSCITE = "PBSCITE32"
'------------------------------------- register the new class ------------------------ //
' Register Code Window Class
szClassName = "PBSCITE32"
wcex.cbSize = SIZEOF(wcex)
wcex.style = %CS_HREDRAW OR %CS_VREDRAW OR %CS_DBLCLKS
wcex.lpfnWndProc = CODEPTR(SciCodeProc)
wcex.cbClsExtra = 0
wcex.cbWndExtra = 4
wcex.hInstance = hInstance
wcex.hIcon = LoadIcon(hInstance, BYVAL %IDI_APPLICATION)
wcex.hCursor = LoadCursor(%NULL, BYVAL %IDC_IBEAM)
wcex.hbrBackground = %COLOR_WINDOW + 1
wcex.lpszMenuName = %NULL
wcex.lpszClassName = VARPTR(szClassName)
wcex.hIconSm = LoadIcon(hInstance, BYVAL %IDI_APPLICATION)
'------------------------------------------------------------- //
FUNCTION CreateWebBrowser (BYVAL hParent AS DWORD) AS DWORD
LOCAL hWndChild AS DWORD, caption AS ASCIIZ*260
' Create the WebBrowser control
hWndChild = CreateWindowEx(%NULL, _ ' extended styles
$PBSCITE, _ ' class name
caption, _ ' caption
%WS_CHILD OR %WS_VISIBLE OR %WS_CLIPSIBLINGS OR _ ' window styles
%WS_TABSTOP, _
0, 0, _ ' left, top
0, 0, _ ' width, height
hParent, %IDC_EDIT, _ '%IDC_IEWB, _ ' handle of parent, control ID
GetModuleHandle(""), BYVAL %NULL) ' handle of instance, creation parameters
FUNCTION = hWndChild
END FUNCTION
'------------------------------------------------------------- //
'------- callback (SciCodeProc)
(usual like wndproc function for sdk win api)
...
CASE %WM_CREATE
GetClientRect hWnd, rc
hEdit = CreateWindowEx(%WS_EX_CLIENTEDGE, "Scintilla", BYVAL %NULL, %WS_CHILD OR %WS_VISIBLE OR _
%ES_MULTILINE OR %WS_VSCROLL OR %WS_HSCROLL OR _
%ES_AUTOHSCROLL OR %ES_AUTOVSCROLL OR %ES_NOHIDESEL, _
0, 0, 0, 0, hWnd, %IDC_EDIT, hInst, BYVAL %NULL) '%IDC_SCIEDIT
pSciData = SendMessage(hEdit, %SCI_GETDIRECTPOINTER, 0, 0)
IF pSciData THEN Scintilla_SetOptions pSciData
...
'------------------------------------------------------------- //
' end
question: what purpose you will follow with this webbrowser ? ;)
best regards, frank
-
Frank..
I am wondering why is you code always confusing to read for me..
question: what purpose you will follow with this webbrowser
simple...to create web broser example like i do in many other compilers ...
nothing ultra-special...
hmmm... ::)
-
question: what purpose you will follow with this webbrowser ?
I would embed a web browser control in a desktop application if I had a web application I wish to integrate with my desktop application and sandbox its navigation.
-
Charles..
what you think that i must do with this subroutines created with EBasic and build dll from them?
How i can call them from oxygen, i have tried in a scintilla way but not work...
any idea?
ebcode in dll...
DEF runwb as INT
DEF wb as window
SUB BrowserWindow(wb:window,x:int,y:int,w:int,h:int,wcap:string,parent:int,mainwb:pointer)
If w=0 then w=480 : If h=0 then h=640
wcap="Test Browse"
parent =0
OPENWINDOW wb,x,y,w,h,@SIZE|@NOAUTODRAW|@MINBOX|@MAXBOX,parent,wcap,&mainwb
If ATTACHBROWSER(wb,"http://www.google.com") = -1
MESSAGEBOX wb, "Couldn't create browser control","Error"
EndIf
ENDSUB
SUB WaitWB
runwb = 1
WAITUNTIL runwb=0
CLOSEWINDOW wb
End SUB
SUB mainwb
Select @MESSAGE
Case @IDCLOSEWINDOW
run = 0
EndSelect
Return
ENDSUB
-
Hi Aurel,
What you want exactly, is in the stars. :D
Your piece of source code is a chaos. This might help or not.
int runwb
int wb
SUB BrowserWindow(int wb, x, y, w, h, string wcap, int parent, *mainwb)
If w=0 then w=480 : If h=0 then h=640
wcap="Test Browse"
int parent=0
OPENWINDOW wb, x, y, w, h, @SIZE|@NOAUTODRAW|@MINBOX|@MAXBOX, parent, wcap, mainwb
If ATTACHBROWSER(wb,"http://www.google.com") = -1
MESSAGEBOX wb, "Couldn't create browser control","Error"
EndIf
END SUB
Sub WAITUNTIL()
while runwb >0
Sleep 10
wend
End Sub
SUB WaitWB()
runwb = 1
WAITUNTIL runwb=0
CLOSEWINDOW wb
End SUB
SUB mainwb()
Select @MESSAGE
Case @IDCLOSEWINDOW
runwb=0
End Select
END SUB
-
Aurel,
Why do you use products with no future and the author in jail? I have shown you how to use the IUP web browser control with little effort. Do you have a phobia with using IUP or are you just into abuse? (@Charles: a repost of the O2 mascot in black leather may be appropriate here. :o )
John
-
John ...please don't post rubish.
EBasic what matter you or me think is not so bad and provide the easiest aproach to lunch
browser window contained in dll shape,so nobody care about EBasic etc than point is how to
call function from this dll,ok.
And about IUP ,as you know i don't wanna use nothing already bloated into another dll
where i don't have a clue what is inside, on this way every function inside that dll will be transparent
and released as open source...ok.
so no need for any kind of drama ;)
PS.If this method will not work i will look again into webbrowser.cpp source of creative Basic .
-
Your piece of source code is a chaos. This might help or not.
;D
Not help but thanks anyway on try,infact you give me idea how might be solved.
But i still need to see what Charles have to say ,EB have different system for pointers and it looks that
more tweaking is needed.
-
Putting up a browser from scratch in Windows, seems to be quite complex. Some C source code would be very useful to study. (The FreeBasic COM-based browser example was very hard to follow )
IUP would be good if adopted for the entire App, as an alternative to Windows.
It is going to be hard work to produce a better browser than Chrome or Firefox :)
-
Charles...
My main problem is how to properly call functions from this dll which i build with EB.
Please do you can look again into this simple code ?
Do i must use LoadLibrary or not?
I will try to build this dll with CDCL format if current shape is not proper,ok ;)
Maybe Kent know something about creating dll in EB ,because i think that he made few dll-s in EB
which he use with thinBasic... ::)
-
Uff i forget to add
in few first lines of dll source which enable exporting:
export myfunction
export myfunction2
:-\
-
small step forward...
after adding export statment i can open browser from dll but only as external window which is not
what i want,i want open browser window like child window( something like scintilla control) :-\
-
Sorry I can't help. I know nothing about eBasic, or Browser interfaces, apart from what I see @Jose/PB and @Freebasic.
-
No problem Charles
As i say ,it work as external browser window ;)
I will wait what Kent have to say...
-
Hey Kent...where are you :)
-
Hey Kent...where are you
Last I heard he was working on his IUP centric cross platform application generator. His integrated help system uses the embedded IUP web browser control and the new IupScintilla control for code editing. I haven't received a response yet if he has any interest in embedding SB for his scripting needs. :o
It looks like you need to get the lead out and find a solution for RubenDev soon. Paul isn't up for a parole hearing for another 10 years so you're on your own.
-
Don't worry will be solved soon, i just need to what type of variable i need to return from dll.
As i say it work like external window but not as child -embeded window. ;)
-
Hint EB is running the browser control in a OCX container. (ATL) Are you providing the same container in O2?
-
Hey Kent...where are you :)
Sorry Aurel, it has been sometime since I worked with ebasic. So I didn't have any help to offer.
-
Don't worry Kent, i know that you create some dll-s but with this web browser is little bit specific
situation,however i have found something in xbLite -which use atl.dll .
-
Hey Kent...where are you
Last I heard he was working on his IUP centric cross platform application generator. His integrated help system uses the embedded IUP web browser control and the new IupScintilla control for code editing. I haven't received a response yet if he has any interest in embedding SB for his scripting needs. :o
It looks like you need to get the lead out and find a solution for RubenDev soon. Paul isn't up for a parole hearing for another 10 years so you're on your own.
John, where is the example for IUP with web browser you mentioned to Aurel, I missed that post I guess? IUP looks very interesting and will be great to use for my help system.
I am thinking of using SQLite for the help data, then present queries outputted to html and formatted with css using IUP, at least that is my plan.
I have been refactoring all my code to have uniform appearance in the meantime, but I am soon ready to document what I have so far.
I am not skilled yet at implementing embedding systems John, but scriptbasic might be a great way to develop my help system with iup and sqlite. I will test that out this week.
-
Wow! My crystal ball didn't lie. :D
Here is an example of using the IUP web browser control (http://www.allbasic.info/forum/index.php?topic=180.msg2366#msg2366) with BaCon under Linux. I haven't tried it with Windows yet. (don't tell Aurel)
-
John, I am amazed at how you can work with all of these languages and libraries. Looks like you are using ubuntu in those examples. I have had good experiences and bad ones with ubuntu, depending on the version installed. But lately, through Virtual Machines, it has been pretty good, except no direct access to opengl.
I am thinking of getting the raspberry pi or the beaglebone black. The beaglebone comes with Angstrom Linux, never heard or used that before. The Raspberry you have to install a version of Debian. Any recommendations. I would like to run linux on dedicated hardware and get out of virtual machines.
Anyways, thanks you have given me lots to learn and I was blown away when I saw your crystal ball report, it does WORK!
-
It looks that the simpliest way will be with ATL based browser than with EB dll( pointer problems).
I have found one JoseRoca example and do the quick test to see if container is created and it looks that is ;)
'gui-skeleton app
$ Filename "ABrowser.exe"
Include "RTL32.inc"
Include "awinh.inc"
#lookahead
INT win,win2
INT x,y,w,h,x2,y2,w2,h2
x=0:y=10:w=800:h=600
x2=410:y2=10:w2=400:h2=300
INT winstyle,wstyle2
winstyle = WS_MINMAXSIZE or WS_CLIPCHILDREN
wbstyle = WS_CHILD OR WS_VISIBLE OR WS_BORDER
INT b0ID = 100
'##### GLOBALS ###############################################
% WM_FORWARDMSG = &H37F ' (895)
% IDB_BACK = 1001
% IDB_FWRD = 1002
% IDB_NAVG = 1003
% IDC_URL = 1004
% IDC_WB = 1005
DECLARE FUNCTION AtlAxWinInit LIB "ATL.DLL" ALIAS "AtlAxWinInit" () AS LONG
DECLARE FUNCTION AtlAxGetControl LIB "ATL.DLL" ALIAS "AtlAxGetControl" ( BYVAL hWnd AS sys,BYREF pp AS sys ) as INT
INT hWb
'##############################################################
'create window **************************************************
win = SetWindow("ATL:Browser",x,y,w,h,0,winstyle)
'
'create button on win
'button0 = SetButton(win,80,4,80,26,"Close Window",0x50000000,0x200,b0ID)
'create second window
AtlAxWinInit ' // Initializes ATL
hWb = CreateWindowEx(0, "AtlAxWin", "Shell.Explorer",wbstyle , 8, 40, w-10, h - 70, win, IDC_WB, 0, 0)
'****************************************************************
'/////////
Wait()
'\\\\\\\\\
Function WndProc (sys hwnd,wmsg,wparam,lparam) as sys callback
SELECT hwnd
'----------------------------------------
CASE win
'----------------------------------------
Select wmsg
CASE WM_CLOSE
DestroyWindow win
PostQuitMessage 0
CASE WM_SIZE
'get current size of window
GetSize(win,0,0,w,h)
',,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,
',,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,
CASE WM_COMMAND
controlID = LoWord(wParam) 'get control ID
notifyCode = HiWord(wParam) 'get notification message
Select controlID
CASE b0ID
If notifycode=0
CloseWindow(win)
EndProgram
End If
End Select
End select
END SELECT
RETURN Default
END FUNCTION
'----------------------------------------------------
'##########################################################
-
That's a big step Aurel. If you can get Jose Roca's COM code working in O2, you will be much farther down the road if you had to convert C code to make it work. The FB web browser example is a taste of what you would have to go through to make it work.
-
John
I just use atl functions and compare both examples...one
from PowerBasic and similar from xbLite atl example.
Infact xbLite is little bit more clear to use and to see what is what.. ;)
-
The important thing is you understand what your looking at. It seems everyone has their own way of serving up COM.
-
Yes there are few different aproaches to this stuff.
I just look again into JoseRoca - MiniBrowser and i think that this might be ok solution. ;)
-
If you get Jose's web browser example working in O2, you will become the COM king here on the forum.
Better yet if you can get Jose's include files working, (preprocessor ?) that would be awesome.
-
Jose include is a huge ...
i have found only two strange things...
type DISPATCH
and i think vObj with PowerBasic ifisobject command.
In Minibrowser is used combination of SendMessage with objects.. ???
Hmm probably this will be combinbation of xbLite stuff and PowerBasic stuff.. ::)
-
hello aurel. two sites (pages) ago I have sent you some code snippets for your question. In my eyes it's not very wise / intelligent to convert ready pobwerbasic commands and object handling (classes and more) for oxygen. you will find more stuff around web browser in freebasic / c++ forum for this task they show youre basically function for it. to translate include files from pbwin to oxygen isn't always a good way that's my experience until today. often you need much less code lines for oxygen and only need declare function at the top for needed *.dll you'd like to work with. there are much more inconveniance between powerbasic and oxygen you know ;) better you're looking at freebasic site. but that's only my personal opinion.
regards, frank
-
FreeBasic example is not far clear than powerBasic at ALL...
and i don't know why both of you ignore my words about xBlite ,looks to me that no
one here know for xBLite ???...
So I REPEAT....
I probably will go in this direction -> powerBasic & xBLite
-
So for now i have this( look in screenshot).
'gui-skeleton app
$ Filename "ABrowser.exe"
Include "RTL32.inc"
Include "awinh.inc"
#lookahead
INT win,win2
INT x,y,w,h,x2,y2,w2,h2
x=0:y=10:w=800:h=600
x2=410:y2=10:w2=400:h2=300
INT winstyle,wstyle2
winstyle = WS_MINMAXSIZE or WS_CLIPCHILDREN
wbstyle = WS_CHILD OR WS_VISIBLE OR WS_BORDER
INT btt0,btt1,btt2
INT b0ID = 100, b1ID=101, b2ID=102
INT bmpB0,bmpB1,bmpB2,bmpB3,bmpB4,bmpB5
bmpB0 = LoadImage(0,"data/goback.bmp",0,28,28,16)
bmpB1 = LoadImage(0,"data/btOpen.bmp",0,30,30,16)
bmpB2 = LoadImage(0,"data/btSave.bmp",0,30,30,16)
'##### GLOBALS ###############################################
% WM_FORWARDMSG = &H37F ' (895)
% IDB_BACK = 1001
% IDB_FWRD = 1002
% IDB_NAVG = 1003
% IDC_URL = 1004
% IDC_WB = 1005
DECLARE FUNCTION AtlAxWinInit LIB "ATL.DLL" ALIAS "AtlAxWinInit" () AS LONG
DECLARE FUNCTION AtlAxGetControl LIB "ATL.DLL" ALIAS "AtlAxGetControl" ( BYVAL hWnd AS sys,BYREF pp AS sys ) as INT
INT hWb
'##############################################################
'create window **************************************************
win = SetWindow("ATL:Browser",x,y,w,h,0,winstyle)
'****************************************************************
'create buttons
btt0 = SetButton(win,4,4,30,30,"<<",0x50000080,0x200,b0ID)
SendMessage btt0 , BM_SETIMAGE, 0, bmpB0
'Initializes ATL
AtlAxWinInit
'create browser window
hWb = CreateWindowEx(0, "AtlAxWin", "www.google.com",wbstyle , 4, 40, w-16,(h-56)-64, win, IDC_WB, 0, 0)
'****************************************************************
'/////////
Wait()
'\\\\\\\\\
Function WndProc (sys hwnd,wmsg,wparam,lparam) as sys callback
SELECT hwnd
'----------------------------------------
CASE win
'----------------------------------------
Select wmsg
CASE WM_CLOSE
DestroyWindow win
PostQuitMessage 0
CASE WM_SIZE
GetSize(win,0,0,w,h)
MoveWindow(hWb,4,40,w-6,(h-56)-32 ,1)
',,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,
',,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,
CASE WM_COMMAND
controlID = LoWord(wParam) 'get control ID
notifyCode = HiWord(wParam) 'get notification message
Select controlID
CASE b0ID
If notifycode=0
CloseWindow(win)
EndProgram
End If
End Select
End select
END SELECT
RETURN Default
END FUNCTION
'----------------------------------------------------
'##########################################################
X
-
King Aurel,
Nice Job!
Mastering COM could be your legacy.
John
-
testing ...
...............testing...................
................................................1...........2..............3
/ i almost forget about this small program ::)
-
Thanks Aurel, I'll add it it to the collection :)
-
OK Charles...
I must check again JoseRoca code to implement standard browsing functions
and also i must look into Creative Basic source
I hope that will work . ;)
-
Hi people
There are some good news about o2 browser example..
after all this mumbo jumbo with Atl i decided to gave up of Atl.
Atl is just a template without additional functions....
so i try again create web dll in EBasic and after 2 hour of testing it
looks that i get embeded (attached) browser into main window.
if all goes well i will add standard browser functions...
-
and here is as child window so act as control...
i still cannot figured how each time resize attached browser ::)
-
Hi Aurel,
Your main window should have some callback attached to it that would be exposed to you entirely as an Oxygen WinMain() in Charles' GUI scripts, or as a series of event subs similar to VB6. In any case, you will have access to either a WM_SIZE message or something that would be similar to OnSize()/OnResize()/etc event handler.
This event handler will usually give access to the new width and height of the main window as it is being resized. For example, if you're using WM_SIZE then its associated lParam will store the new width in its low word half, and the new height, in its high word half.
You should use a call to e.g. MoveWindow() or SetWindowPos() WinAPI in this event handler or Case WM_SIZE to resize your child browser window by its own hWnd to a new size proportionately to the changes in the main window's width and height, usually preserving the original aspect ratio of the child browser window.
-
Analogy: Adding COM support to your BASIC application.
(http://www.classiccarstodayonline.com/wp-content/uploads/2013/02/1971-Buick-6-wheels-c.jpg)
P.S. I recently owned a 73 Imperial with a 440. It was like a living room on wheels. Sold it when gas prices started approaching $3. A fun highway car. It held the record in town as the longest stock passenger car. It was called John's Green Bean. What a beast!
This is what my car looked like but string bean green.
(http://carmine.5u.com/images/73imperial2.jpg)
-
thanks Mike
I understand very well what i must to do because i have a lot of experience with
controls ..etc
but this situation is not typical .
EB have automatic resize of window with flag @size
i must find value of this flag...i will pos code later and you will see that
is little bit tricky.. :D
-
Aurel,
In Windows, you can subclass any window with your own callback to get access to its internal message pipe and use its WM_SIZE and other messages for whatever you want. If you can't get or figure out or use any original flag or event handler or whatever of a window, just subclass it and be done with it.
This is how astonishing results are being achieved in VB6 which is otherwise a futile black box designed for dummies.
-
John,
This baby looks like its hood and front wheels would be leaving the town while its rear is still five hundred yards behind the city line.
Do you also wear a Stetson, neckerchief and cowboy boots to match?
$3 you say? Per gallon? And calling it expensive?!
:D
-
Recently owned = 8 years ago. ;)
That baby would lay rubber even as heavy as it was. I had it over 100 on a stretch of Hwy. and still had peddle. If I were ever in a car accident, I would feel bad for the other guy.
-
$3 you say? Per gallon? And calling it expensive?!
what?
where ? in Canada orrrrrrrrrrrrrrrrrrrrrrrr?