Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Expandable File Folder Contents opening in TbWebBrowser
#3
Function TbExpFolderMenuOpenInWebBrowser
Code:
Copy      Help
;/
function $menuname [$tbname]

;Shows a menu and opens the selected file in web browser on a QM toolbar.
;The menu must have these properties (checked in Properties): 'don't run ...', 'expand file folders'.
;Example of adding web browser to a toolbar is in c:\program files\quick macros 2\installed files\samples2.qml.


;menuname - menu name.
;tbname - toolbar name. Can be omitted when this function is called from the toolbar.


;EXAMPLE toolbar
;;/hook ToolbarExProc_TWWB /siz 500 300 /set 2
;Favorites :TbExpFolderMenuOpenInWebBrowser "menu favorites"


;EXAMPLE menu ("menu favorites")
;;/dontrun /expandfolders
;fav "$favorites$"



int h; str s
;get toolbar hwnd
if(len(tbname)) s=tbname; h=win(s.ucase "QM_toolbar")
else h=val(_command)
if(!h) ret
;show the menu and wait
if(!mac(menuname)) ret
;get selected path
qm.GetLastSelectedMenuItem 0 &s 0
;open in toolbar web browser
WebInQmActiveX s 0 h

Function WebInQmActiveX
Code:
Copy      Help
;/
function# $url [flags] [hwnd] [$url2] [str&geturl2] [&gethwnd] ;;flags: 1 wait, 2 in existing window, 4 in new window, 8 in new IE, 12 in new IE7 tab, 16 url2 exact, 32 get IES hwnd, 64 don't activate, hiword max wait time

;Opens url in a web browser control that is in a QM dialog or other QM window.
;The same as the intrinsic web function, but does not fail if the control currently is not displaying a web page (it may be empty or display a document of other type).


;hwnd - handle of the ActiveX control host control or parent window.
;Other arguments - the same as with web.


;Returns 1 if successful, 0 on error.
;Unlike web, does not return IWebBrowser2 interface pointer. If you need it, use _getcontrol.



;g1
int retry
web url 0 hwnd url2 geturl2 gethwnd
err ;;probably could not connect because is not displaying a web page. Open blank page and retry.
,if(retry) ret
,retry=1
,if(!childtest(hwnd "" "ActiveX")) hwnd=child("" "ActiveX" hwnd); if(!hwnd) ret
,SHDocVw.WebBrowser b._getcontrol(hwnd)
,b.Navigate("about:blank")
,rep() if(b.Busy) wait 0.01; else goto g1
ret 1

---

Up one level button:
Code:
Copy      Help
Up :SHDocVw.WebBrowser b._getcontrol(child("" "ActiveX" val(_command))); str s=b.LocationURL; if(s.begi("file:///")) s.get(s 8); s.findreplace("/" "\"); s.getpath; out s; b.Navigate(s)


Messages In This Thread

Forum Jump:


Users browsing this thread: 1 Guest(s)