ret ;messages sel message ,caseWM_INITDIALOG ,SHDocVw.WebBrowser we3 ,;we3._getcontrol(id(3 hDlg)) , , ,caseWM_DESTROY ,caseWM_COMMANDgoto messages2 ret ;messages2 sel wParam ,case4;;Zoom font ,we3._getcontrol(id(3 hDlg)) ,VARIANT v=4;;0 to 4, default 2 ,we3.ExecWB(OLECMDID_ZOOMOLECMDEXECOPT_DONTPROMPTUSER v 0) , ,case5;;Zoom optical ,if(_iever<0x700)mes"supported in IE7 and later";ret ,we3._getcontrol(id(3 hDlg)) ,v=200;;10 to 1000 %, default 100 ,we3.ExecWB(OLECMDID_OPTICAL_ZOOMOLECMDEXECOPT_DONTPROMPTUSER v 0) , ,caseIDOK ,caseIDCANCEL ret1
You probably also noticed that when you change font size in IE, then new WebBrowser controls use the same font size as in IE. Probably saves in registry but I don't know where.
Hi Gintaras,
I used the dialog SHDocVw.WebBrowser with tabs and loaded the tabs from a folder full of html tabs. The sites are mostly journals with PDFs. The pdfs load fine but won't scroll. They actually lock up all functions of the dialog (tabs don't switch, etc). Everyone in a while, the pages advance very rapidly but then everything locks up right away again.
I tried loading up PDFs in the dlg from resources called "dlg_simple_web_browser" and it worked perfectly. Maybe the difference is that the multi-tab dialog works by opening the html files rather than navigating to the web site e.g. "c.Navigate("www.journal.com"); err"
Is the html file way faster?
Could I populate a mult-tab browser by just Selecting the Tab (SelectTab) and then navigating. Would this be slower in loading up the websites (> ~20)?
Thanks for any advice on how to get the pdfs working properly?
Stuart
ps. I am using Adobe Reader 9 and it is defaulting to opening the pdf document "in" the browser.
Quote:Before last line, insert
Function dlg_tabbed_web_browser ?
,,BringWindowToTop r.hwndwb
I am now trying to add a back button to the dialog. With browsers with a SHDocVw.WebBrowser we3._getcontrol(h) statement you can use
the case 4 we3.GoBack
case 5 we3.GoForward
case 6 we3.Stop
case 7 we3.Refresh
case 8 we3.GoHome
but doesn't seem to be the way the multi-tab dialog with web-browser is set up. I couldn't seem to set up the equivalent in this type of dialog. Any suggestions other than sending key commands to the window?
Thanks Gintaras,
That actually provides the strategy to do many things that I wanted with that dialog. I also came across a description of something like this in the help menu - an AMAZING resource.
Thanks,
Stuart
Hi Gintaras,
I am trying to convert the dlg_tabbed_web_browser above to pre-load a a few websites rather than a folder of .htm files. Let's say www.google.com, www.bing.com, www.yahoo.com. Thought something like this existed in the forum but can't seem to figure it out. The trick is that the url's need to pre-populate the tabs and then allow the user to switch back and forth without reloading or going back to the original url, even if the user clicks through to some link in the individual tabs.
I thought it would be easy to adjust the code above but I got to admit the ta[i].hwndwb part is throwing me a bit.
Amazing!!!! Thanks so much!!!
One additional question..
Sometime I need to update the various tabs from external functions. So what I have done is give each browser control a unique global int+ in the main dialog:
I would do differently. The dialog function should manage its controls, because it knows better how to do it, and because it's better to do it in its thread. External function should send a message to tell the dialog function to do it.
,caseWM_APP+1 ,;A macro can send this message to select a tab and load a page. ,;wParam is tab index, lParam is URL; if lParam 0, just selects tab. ,;Returns current tab index (before changing). ,;Don't send from other process. ,;EXAMPLES ,;int w=win("QM tabbed web browser" "#32770") ,;SendMessage w WM_APP+1 2 0 ;;select tab 2 ,;SendMessage w WM_APP+1 1 "www.quickmacros.com" ;;select tab 1 and load URL , ,_i=iTab ,if wParam>=0and wParam<ta.len ,,if(wParam!=iTab)SelectTabid(3 hDlg) wParam ,,if lParam ,,,lpstr URL=+lParam ,,,wbDTWB2._getcontrol(ta[wParam].hwndwb) ,,,wbDTWB2.Navigate(@URL) ,ret _i ,
If don't want or cannot edit dialog code, this should work:
SelectTab id(3 w) iTab
URL.setwintext(id(100+iTab w))
this is almost too good!!! and a great template for other dialog interactions that I do with external threads and global variables, which I know is a messy way of coding....thanks for all the examples of safe and elegant coding.
Thanks as always,
S
Hi Gintaras,
Hope all is well! I still use QM to do amazing things everyday.
I was wondering if there is a good way to load up all the tabs at startup, so for the user they are pre-loaded when they go to that tab. For the example below, everything would load quickly at tab selection, but for some websites that is not the case. When I move up the control creation and navigate code up to WM_INITDIALOG, it does preload them, but there is an initial period where things look like they are going crazy, rapidly rotating through all the tabs. Then once everything is loaded, it settles down and behaves like I intend. Is there a better way to do this. Obviously, not good for user to see this. I can hide the tabs during that period but wondering if there is a better way. Also, if I have many many browser tabs, say ~30, it would be nice to now there progress in loading, i.e. when they are all done so I can unhide the controls. Or is this not the ideal way to work with this many tabs.
I also worry about resources of having so many separate ActiveX WebBrowsers - maybe there is a better way to achieve this.
Thanks,
SÂ