Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
IE in a Dialog
#1
Once when browsing the forum i saw an example made where it was an Internet Explorer in a dialog

It was complete with Back Button and Forward Button as well as refresh

I have searched the forum for a while and cannot seem to find this topic

Can anyone provide a link to it or the same file?

Thanks so much
#2
Should be in Resources -> first topic -> attachment.
#3
I know this is an old thread, but can provide a simple example of a browser in a dialog using the current version of quickmacros, with forward,backward,stop,refresh and home button please?

Thank you.
#4
Macro QM web browser
Code:
Copy      Help
\Dialog_Editor

str dd=
;BEGIN DIALOG
;0 "" 0x90CF0AC8 0x0 0 0 582 382 "Dialog"
;3 ActiveX 0x54030000 0x0 0 48 582 334 "SHDocVw.WebBrowser {8856F961-340A-11D0-A96B-00C04FD705A2}"
;4 ToolbarWindow32 0x54030001 0x0 0 0 582 17 ""
;5 Edit 0x54030080 0x200 0 28 582 13 ""
;END DIALOG
;DIALOG EDITOR: "" 0x2040202 "*" "" "" ""

str controls = "3 5"
str ax3SHD e5
if(!ShowDialog(dd &sub.DlgProc &controls)) ret


#sub DlgProc
function# hDlg message wParam lParam

int- t_hdlg
__ImageList-- t_il
sel message
,case WM_INITDIALOG
,t_hdlg=hDlg
,DT_SetAutoSizeControls hDlg "3s 5sh"
,sub.ToolbarInit id(4 hDlg) t_il
,
,SHDocVw.WebBrowser we3
,we3._getcontrol(id(3 hDlg))
,we3._setevents("sub.we3")
,
,we3.Silent=TRUE ;;prevent script error messages
,we3.Navigate("http://www.google.com") ;;or we3.GoHome
,
,case WM_COMMAND goto messages2
ret
;messages2
sel wParam
,case [101,102,103,104,105,106]
,err-
,we3._getcontrol(id(3 hDlg))
,sel wParam
,,case 101 we3.GoBack
,,case 102 we3.GoForward
,,case 103 we3.Stop
,,case 104 we3.Refresh
,,case 105 we3.GoHome
,,case 106 we3.Navigate(_s.getwintext(id(5 hDlg)))
,err+
,
,case IDOK
,if(GetFocus=id(5 hDlg)) PostMessage hDlg WM_COMMAND 106 0 ;;on Enter press Go
,ret 0 ;;disable closing on Enter
,case IDCANCEL
,ifk(Z) ret 0 ;;disable closing on Esc
ret 1


#sub ToolbarInit
function htb __ImageList&il

il.Load("$qm$\il_qm.bmp") ;;load an imagelist created with the imagelist editor
;;or
;il.Load("resource:<QM web browser>image:QM web browser") ;;load an imagelist created with the imagelist editor and added to macro resources
;;or
;il.Create("file1.ico[]file2.ico[]file3.ico") ;;create imagelist at run time from icons. Slower.

SendMessage htb TB_SETIMAGELIST 0 il
SetWinStyle htb TBSTYLE_FLAT|TBSTYLE_TOOLTIPS 1

ARRAY(str) as="Back[]Forward[]Stop[]Refresh[]Home[]Go"
ARRAY(TBBUTTON) ab.create(as.len)
int i
for i 0 ab.len
,TBBUTTON& t=ab[i]
,t.idCommand=101+i
,t.iBitmap=i
,t.iString=SendMessage(htb TB_ADDSTRINGA 0 as[i])
,t.fsState=TBSTATE_ENABLED

SendMessage(htb TB_BUTTONSTRUCTSIZE sizeof(TBBUTTON) 0)
SendMessage(htb TB_ADDBUTTONS ab.len &ab[0])
SendMessage(htb TB_AUTOSIZE 0 0)


#sub we3_DocumentComplete
function IDispatch'pDisp VARIANT&URL SHDocVw.WebBrowser'c

;out URL

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

;BEGIN PROJECT
;main_function  QM web browser
;exe_file  $desktop$\QM web browser.exe
;icon  <default>
;manifest  $qm$\default.exe.manifest
;flags  6
;guid  {5C25336D-BE35-4BAF-8461-DABD57D6FB06}
;END PROJECT
#5
Thank you for the web browser code.

I notice when I compiled it into standalone exe, whenever I run it on a computer, an empty My QM folder is created in my documents folder. Is there a setting to prevent the compiled standalone exe from creating that folder?

Thank you.
#6
This bug will be fixed in next QM version.
Or you can fix it now. Download and unzip the attached file to the QM folder. Usually it is C:\Program files (x86)\Quick Macros 2. Then re-make all your QM-created exe files that will live on other computers.


Attached Files
.zip   qmmacro.zip (Size: 219.82 KB / Downloads: 354)
#7
I already try creating a similar .bmp file like il_state.bmp with another set of icons in the bmp file but it won't show in the above example. Sad

Can show an example of each button above with individual .ico/bmp files instead?
#8
See the updated example. Use the il.Create(...) line instead of il.Load(...).


But with an imagelist .bmp file the dialog will be loaded faster, because don't need to load many .ico files at run time. To make it work:
Open the imagelist editor. It is in the floating toolbar, "more tools" button.
Create new imagelist: click the combo box, "<New>".
Click "Add" and read how to add icons. Add icons.
Click "More Actions", "Open imagelist folder". You will see a new .bmp file.
You can use this file in macros, for example il.Load($my qm$\imagelists\QM web browser.bmp).
If you'll use it in .exe, you can copy the .bmp file to your exe folder and use il.Load($qm$\imagelists\QM web browser.bmp).
Or you can add the .bmp file to macro resources: menu Tools -> Resources -> Import from file. Then use code: il.Load("resource:<QM web browser>image:QM web browser").


Forum Jump:


Users browsing this thread: 1 Guest(s)