Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Web Dialog Help
#1
Hey im wondering is there anway to make it so if they go to a site and click a link the url changes can u make it change the url in the edit box?

My Dialog:

Function ( Dialog2 ) Trigger ( F4 )
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))
,c.Navigate("www.google.com")
,str a d s z y n
,lpstr lp
,case WM_DESTROY
,case WM_COMMAND goto messages2
ret
;messages2
sel wParam
,case 5
,,a.getwintext(id(4 hDlg))
,,lp=a
,,z=lp
,,y=".com"
,,s.right(lp 4)
,,if(s != ".com" and s != ".net")
,,,a+y
,,,a.setwintext(id(4 hDlg))
,,,goto website
,,else
,,,goto finalwebsite
,;website
,SHDocVw.WebBrowser b
,b._getcontrol(id(3 hDlg))
,b.Navigate(a)
,;finalwebsite
,SHDocVw.WebBrowser w
,w._getcontrol(id(3 hDlg))
,w.Navigate(a)
,
,case 6
,b._getcontrol(id(3 hDlg))
,b.GoBack


,case IDOK
,case IDCANCEL
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

Please Help

Thanks
#2
Any 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.
#4
OK Great code but only 1 problem i had incorporated a code into that to check to see if last 4 letters were .com or .net and ifnot to add .com and now thats gone is there anyway to add that?
#5
I removed that because if you type

http://www.quickmacros.com/forum

you get

http://www.quickmacros.com/forum.com
#6
ok, is there anyway to do what i was doing in replace of it?


Forum Jump:


Users browsing this thread: 1 Guest(s)