Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Use button on the child window to open webpage on the main window
#6
Thank you, very good. Smile

I found the code for the second dialog in the code.

What is his role? Huh

I added the hotkey F10 to the code to make the window full screen.

However, in actual use, there are often errors in not finding objects. I set the wait and still have errors.

How to use full screen code is more stable?


Macro Macro1
Trigger SF9     Help - how to add the trigger to the macro
Code:
Copy      Help
str dd=
;BEGIN DIALOG
;0 "" 0x90C80AC8 0x0 0 0 900 432 "Dialog"
;4 ActiveX 0x54030000 0x0 0 0 900 432 "SHDocVw.WebBrowser {8856F961-340A-11D0-A96B-00C04FD705A2}"
;END DIALOG
;DIALOG EDITOR: "" 0x2040700 "*" "" "" ""

WebBrowserControlDisableIE7Emulation
str controls = "4"
str ax4SHD
ax4SHD="http://fs.focusky.com.cn/jhgh/tdzl/index.html"
if(!ShowDialog(dd &sub.DlgProc &controls)) ret

#sub DlgProc
function# hDlg message wParam lParam
int- t_MhDlg
sel message
,case WM_INITDIALOG
,DT_SetAccelerators hDlg "410 F10[]412 F12"
,SetTimer hDlg 1 100 0
,SHDocVw.WebBrowser we4
,we4._getcontrol(id(4 hDlg))
,we4._setevents("sub.we4")
,t_MhDlg=hDlg
,case WM_TIMER
,sel wParam
,,case 1
,,int wies=child("" "Internet Explorer_Server" id(4 hDlg)); if(wies=0) ret
,,SetWindowSubclass(wies &sub.WndProc_Subclass 2 0)
,,int mfpax2 mfpax=child("" "MacromediaFlashPlayerActiveX" id(4 hDlg));
,,if(mfpax!=0 and mfpax2!=mfpax)
,,,SetWindowSubclass(mfpax &sub.WndProc_Subclass 2 0)
,,,mfpax2=mfpax
,,else
,,,ret
,,KillTimer hDlg wParam
,case WM_DESTROY
,case WM_COMMAND goto messages2
ret
;messages2
sel wParam
,case 410
,key F11
,0.1
,scan "image:hAF522030" 0 0 1|2|16
,lef
,case IDOK
,case IDCANCEL
ret 1

#sub WndProc_Subclass
function# hwnd message wParam lParam uIdSubclass dwRefData

;OutWinMsg message wParam lParam ;;uncomment to see received messages

sel message
,case WM_RBUTTONDOWN
,str s=
,;1 Change Main dialog url
,;2 Google
,;3 Yahoo
,;4 Bing
,;5 Quick Macros Forum
,
,MenuPopup x.AddItems(s)
,int i=x.Show
,int- t_MhDlg
,SHDocVw.WebBrowser wb
,wb._getcontrol(id(4 t_MhDlg))
,sel i
,,case 1
,,str url=wb.LocationURL
,,if url = "http://fs.focusky.com.cn/jhgh/tdzl/index.html"
,,,wb.Navigate("http://fs.focusky.com.cn/slgus/ybbt/index.html?flash")
,,else
,,,wb.Navigate("http://fs.focusky.com.cn/jhgh/tdzl/index.html")
,,SetTimer t_MhDlg 1 100 0
,,case 2
,,wb.Navigate("https://www.google.com")
,,case 3
,,wb.Navigate("https://www.yahoo.com")
,,case 4
,,wb.Navigate("https://www.bing.com")
,,case 5
,,wb.Navigate("http://www.quickmacros.com/forum")
,ret

int R=DefSubclassProc(hwnd message wParam lParam)

sel message
,case WM_NCDESTROY
,RemoveWindowSubclass(hwnd &sub.WndProc_Subclass uIdSubclass)
,
,;case ...

ret R

#sub we4_NewWindow3
function IDispatch&ppDisp @&Cancel dwFlags BSTR'bstrUrlContext BSTR'bstrUrl SHDocVw.IWebBrowser2'we3

int hDlg2=sub.Dialog2
SHDocVw.WebBrowser d2_we3._getcontrol(id(3 hDlg2))
ppDisp=d2_we3


#sub Dialog2
function# [hwndOwner] [~url]

str dd=
;BEGIN DIALOG
;0 "" 0x90CF0AC8 0x0 0 0 900 432 "Dialog2"
;3 ActiveX 0x54030000 0x0 0 0 900 432 "SHDocVw.WebBrowser {8856F961-340A-11D0-A96B-00C04FD705A2}"
;END DIALOG
;DIALOG EDITOR: "" 0x2040701 "*" "" "" ""

str controls = "3"
str ax3SHD
if(!empty(url))
,ax3SHD=url
ret ShowDialog(dd &sub.DlgProc2 &controls hwndOwner 1) ;;modeless dialog


#sub DlgProc2
function# hDlg message wParam lParam
int- t_hdlg

sel message
,case WM_INITDIALOG
,SHDocVw.WebBrowser we3
,we3._getcontrol(id(3 hDlg))
,we3._setevents("sub.we3")
,t_hdlg=hDlg
,DT_SetAutoSizeControls hDlg "3s"
,SetTimer hDlg 1 100 0
,case WM_TIMER
,sel wParam
,,case 1
,,int wies=child("" "Internet Explorer_Server" id(3 hDlg)); if(wies=0) ret
,,SetWindowSubclass(wies &sub.WndProc_Subclass 2 0)
,,KillTimer hDlg wParam
,case WM_DESTROY
,case WM_COMMAND goto messages2
,case WM_CLOSE
,DT_Ok(hDlg)
ret
;messages2
sel wParam
,case IDOK
,ifk(Y)
,,key Y           ;; Enter
,,ret 0
,case IDCANCEL
,ret 0
ret 1

#sub we3_WindowClosing
function @IsChildWindow @&Cancel ;;SHDocVw.IWebBrowser2'we3

Cancel=1
int- t_hdlg
clo t_hdlg
;BEGIN PROJECT
;main_function  Macro1
;exe_file  $my qm$\Macro1.exe
;icon  <default>
;manifest  $qm$\default.exe.manifest
;flags  6
;guid  {4720E404-009B-439E-8B75-8947532A37AE}
;END PROJECT


Attached Files Image(s)
   


Messages In This Thread
RE: Use button on the child window to open webpage on the main window - by win - 09-11-2018, 09:51 PM

Forum Jump:


Users browsing this thread: 6 Guest(s)