Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Opening .pdf or .doc files in Toolbar with WebBrowser
#1
Hi All,

Since the Toolbar with webbrower calls the function ToolbarExProc_TWWB, I figured I couldn't use it to call up documents with run command rather than web command

BUT

I got half-clever and realized IE can call up those documents within the browser

e.g.

Code:
Copy      Help
Pdf Title :web "C:\Documents and Settings\All Users\Documents\Sample.pdf" 0x0 win("ToolbarTItle" "QM_toolbar") *

This works great to bring up the pdf (with all the in-webpage pdf controls) all within the toolbar - which if you set to autoshrink is really phenomenal.

BUT when I try to go to any other choice, I get:

Quote:Error (RT) in Sample Menu: cannot find or connect to a compatible browser window

Somehow bringing up a pdf in the browser window changes its nature somewhat.

Is there any flag or some other mechanism to make this work?

Stuart
#2
web can connect to web browser control only if it displays html document.

Do like in the hook function - through WebBrowser interface.

Code:
Copy      Help
int h=win("TOOLBAR WITH WEB BROWSER" "QM_toolbar"); if(!h) ret
SHDocVw.WebBrowser b._getcontrol(id(100 h))

b.Navigate(_s.expandpath("$personal$\Book1.xls"))
5
b.Navigate("http://www.quickmacros.com")
#3
Hi Gintaras,
I am not sure I understand your solution
Do I add the potential pdf locations to the ToolbarExProc_TWWB function or is this a new function?

The way I have this set up is that there are toolbar items across the top of the popup toolbar. Each one calls up a webpage or a pdf item within the toolbar window (which then acts like a browser between them). TO make this happen, I have appended


Code:
Copy      Help
win("TOOLBAR WITH WEB BROWSER" "QM_toolbar")

to each menu item, like this:

Code:
Copy      Help
/hook ToolbarExProc_TWWB /siz 800 220 /set 2
Lifehacker, the Productivity and Software Guide :web "http://www.lifehacker.com/" win("TOOLBAR WITH WEB BROWSER" "QM_toolbar")
Google :web "http://www.google.com/" win("TOOLBAR WITH WEB BROWSER" "QM_toolbar")
Sample.pdf :web "$personal$\neuroimaging.pdf" win("TOOLBAR WITH WEB BROWSER" "QM_toolbar")
Back :web "Back" 0 TriggerWindow **

How Do I modify the hook function to allow this.

Will each menu item have to call up a separate ToolbarExProc_TWWB function to make this work?

By the way, what is the purpose of multiple website/file listings in the function?
Code:
Copy      Help
sel message
    case WM_CREATE
    int h=CreateControl(0 "ActiveX" "SHDocVw.WebBrowser" 0 0 20 200 200 hWnd 1)
    SHDocVw.WebBrowser b._getcontrol(h)
    b.Navigate("about:blank")
    b.Navigate("http://www.google.com")
    case WM_DESTROY



Maybe more step-by-step explanation. I have come a long way in QM but sometimes need a little bit more help.


Thanks!!,
Stuart
#4
Function OpenInTbWebBrowser
Code:
Copy      Help
;/
function $url [$tbname]

;Opens url in web browser control on a QM toolbar.
;Example of adding web browser control to a toolbar is in c:\program files\quick macros 2\installed files\samples2.qml.


;url - a URL or a local file of supported format (htm, txt, doc, xls, pdf, gif, folder, etc).
;tbname - toolbar name. Can be omitted when this function is called directly from the toolbar.


;EXAMPLE (toolbar)
;;/hook ToolbarExProc_TWWB /siz 500 300 /set 2
;www.quickmacros.com :OpenInTbWebBrowser "http://www.quickmacros.com" * web.ico
;Book1.xls :OpenInTbWebBrowser "$personal$\Book1.xls" * $personal$\Book1.xls



int h
str s=tbname
if(s.len) h=win(s.ucase "QM_toolbar")
else h=val(_command) ;;if called from tb, tb handle is stored in _command
SHDocVw.WebBrowser b._getcontrol(child("" "ActiveX" h))
b.Navigate(_s.expandpath(url))
err+ out _error.description

---

Quote:How Do I modify the hook function to allow this.

Will each menu item have to call up a separate ToolbarExProc_TWWB function to make this work?

By the way, what is the purpose of multiple website/file listings in the function?

Don't need to modify.
Each menu item have to call OpenInTbWebBrowser (see example inside the function).
Just an example. If initially it should be empty, use only "about:blank".
#5
Hi Gintaras,

That solution rocks!
I wish you could see how slick this is working.
I know have a Pop-Up stripped-down Browser/Reference Doc Collection - available at all times just by hovering over a small sidebar tab (using autoshrink)

This is like the mac toolstrip and google toolbar popup rolled into one.

Long live QM!

Stuart


Forum Jump:


Users browsing this thread: 1 Guest(s)