Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Web Dialog Help
#3
To get current URL, use c.LocationURL.

Now when you can get it? There are two ways:

1. Use SetTimer/WM_TIMER to see when the URL changes.

2. Use c._setevents.

This example catches DocumentComplete event and populates the edit control. Plus adds some enhancements to your code.

Function Dialog2
Code:
Copy      Help
\Dialog_Editor
function# hDlg message wParam lParam
if(hDlg) goto messages

;BEGIN DIALOG
;0 "" 0x90C80A44 0x100 0 0 565 386 "My Web Browser"
;3 ActiveX 0x54030000 0x0 4 22 558 358 "SHDocVw.WebBrowser"
;4 Edit 0x54030080 0x200 4 4 450 14 ""
;5 Button 0x54032000 0x0 458 4 48 14 "GO"
;6 Button 0x54032000 0x0 512 4 48 14 "BACK"
;END DIALOG
;DIALOG EDITOR: "" 0x2020103 "" "" ""


str controls = "3 4"
str ax3SHD e4
if(!ShowDialog("Dialog2" &Dialog2 &controls)) ret

ret
;messages
sel message
,case WM_INITDIALOG
,SHDocVw.WebBrowser c
,c._getcontrol(id(3 hDlg))
,
,int- t_hdlg; t_hdlg=hDlg
,c._setevents("c_DWebBrowserEvents2")
,
,c.Navigate("www.google.com"); err
,
,case WM_DESTROY
,case WM_COMMAND goto messages2
ret
;messages2
c._getcontrol(id(3 hDlg))
sel wParam
,case 5 ;;Go
,str a.getwintext(id(4 hDlg))
,c.Navigate(a); err
,
,case 6
,c.GoBack; err

,case IDOK
,but 5 hDlg ;;on Enter press GO
,ret 0 ;;disable closing on Enter
,case IDCANCEL
,ifk(Z) ret 0 ;;disable closing on Esc
ret 1


;BEGIN PROJECT
;main_function  Dialog2
;exe_file  $desktop$\Qmr55's Web Browser.exe
;icon  $qm$\web.ico
;manifest  $qm$\default.exe.manifest
;res  
;on_before  
;on_after  
;on_run  
;flags  0
;end_hotkey  0
;guid  {29304E3B-816A-4319-8538-CBAD0FD38FDD}
;END PROJECT

Function c_DocumentComplete
Code:
Copy      Help
;/
function IDispatch'pDisp VARIANT&URL SHDocVw.IWebBrowser2'c

;out URL

int- t_hdlg
str s=c.LocationURL
s.setwintext(id(4 t_hdlg))

The second function must be in folder c_DWebBrowserEvents2. The folder and the function is created for you when you type c. and double click the event in the list. Events have yellow lightning icon.


Messages In This Thread

Forum Jump:


Users browsing this thread: 1 Guest(s)