Posts: 726
Threads: 99
Joined: Mar 2018
I want to use the menu to open Google from the browser, but the runtime prompts error
Just contact programming, I hope someone can help me, any opinions and suggestions are welcome, thank you
Macro
Macro1
str md=
;BEGIN MENU
;>&File
;,&open google :502 0x0 0x0 Cg
;,-
;,E&xit :2 0x0 0x0 Aq
;,<
;END MENU
str dd=
;BEGIN DIALOG
;0 "" 0x90CB0AC8 0x0 0 0 412 222 "Dialog"
;4 ActiveX 0x54030000 0x0 12 16 392 172 "SHDocVw.WebBrowser {8856F961-340A-11D0-A96B-00C04FD705A2}"
;1 Button 0x54030001 0x4 292 196 48 14 "OK"
;2 Button 0x54030000 0x4 356 196 48 14 "Cancel"
;END DIALOG
;DIALOG EDITOR: "" 0x2040700 "*" "" "" ""
str controls = "4"
str ax4SHD= "www.quickmacros.com"
if ( ! ShowDialog ( dd & sub.DlgProc & controls 0 0 0 0 0 0 0 0 md)) ret
#sub DlgProc
function # hDlg message wParam lParam
sel message
, case WM_INITDIALOG
, SHDocVw. WebBrowser -- we4
, case WM_DESTROY
, case WM_COMMAND goto messages2
ret
;messages2
sel wParam
, case IDOK
, case IDCANCEL
, case 502 ;;&open google
, we4.Navigate ( "http://www.google.com" )
ret 1
Attached Files
Image(s)
Posts: 12,073
Threads: 140
Joined: Dec 2002
before we4.Navigate or before sel wParam:
, we4._getcontrol( id ( 4 hDlg))
Posts: 726
Threads: 99
Joined: Mar 2018
(04-19-2018, 05:00 AM) Gintaras Wrote: before we4.Navigate or before sel wParam:
, we4._getcontrol( id ( 4 hDlg))
Thank you for your help, I put the definition statement above
Attached Files
Image(s)
Posts: 12,073
Threads: 140
Joined: Dec 2002
I would put it immediately before sel wParam. Calling _getcontrol on every received message is not good. If need it above sel wParam, insert it in all places where need.
Posts: 726
Threads: 99
Joined: Mar 2018
(04-19-2018, 06:14 AM) Gintaras Wrote: I would put it immediately before sel wParam. Calling _getcontrol on every received message is not good. If need it above sel wParam, insert it in all places where need.
Thanks for reminding,
In addition, I would like to ask, how to insert a flash control in the dialog box? I tried several times and I can't display it in a dialog box. Can you give me an example? thank you very much
Posts: 12,073
Threads: 140
Joined: Dec 2002
04-19-2018, 11:21 AM
(This post was last modified: 04-19-2018, 11:25 AM by Gintaras .)
Posts: 726
Threads: 99
Joined: Mar 2018
(04-19-2018, 11:21 AM) Gintaras Wrote: http://www.quickmacros.com/forum/viewtop...f=2&t=3368
download and search for
*flash*
I have found an example, thank you very much
Posts: 726
Threads: 99
Joined: Mar 2018
(04-19-2018, 11:21 AM) Gintaras Wrote: http://www.quickmacros.com/forum/viewtop...f=2&t=3368
download and search for
*flash*
I found an example, the window full screen after the problem, I can not see the characters on the control, I adjust the parameters, can not be resolved
Function
dlg_simple_web_browser
\Dialog_Editor
function # hDlg message wParam lParam
if ( hDlg) goto messages
;BEGIN DIALOG
;0 "" 0x90CB0A48 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: "" 0x2040700 "" "" "" ""
str controls = "3 4"
str ax3SHD e4
if ( ! ShowDialog ( "dlg_simple_web_browser" & dlg_simple_web_browser & controls)) ret
ret
;messages
sel message
, case WM_INITDIALOG
, DT_SetAutoSizeControls hDlg "0s 3s 4s 5s 6s"
, SHDocVw. WebBrowser c
, c._getcontrol ( id ( 3 hDlg))
,
, int - t_hdlg; t_hdlg= hDlg
, c._setevents ( "c_DWebBrowserEvents2" )
,
, c.Navigate ( "www.quickmacros.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 dlg_simple_web_browser
;exe_file $my qm$\dlg_simple_web_browser.exe
;icon <default>
;manifest $qm$\default.exe.manifest
;flags 6
;guid {A55F76DB-D45A-4213-A6F8-5D29FA99BB6E}
;END PROJECT
Attached Files
Image(s)
Posts: 12,073
Threads: 140
Joined: Dec 2002
Probably "0s 3s 4s 5s 6s" is incorrect. Read DT_SetAutoSizeControls help.
Posts: 726
Threads: 99
Joined: Mar 2018
(04-19-2018, 03:22 PM) Gintaras Wrote: Probably "0s 3s 4s 5s 6s" is incorrect. Read DT_SetAutoSizeControls help.
DT_SetAutoSizeControls hDlg "0sh 3s 4sh 5mh 6mh"
thanks