'demonstration of an embedded browser window used in a dialog def wb:window def urldlg:DIALOG def x,y,w,h:int 'The dialog and a few controls CREATEDIALOG urldlg,0,0,600,800,0x80C00080|@SYSMENU|@SIZE,0,"Web Browser with Embedded PDF",&Handler 'Show the dialog as non modal SHOWDIALOG urldlg 'the browser window OPENWINDOW wb,0,0,600,800,@NOAUTODRAW|@NOCAPTION,urldlg,"Web Browser",&main IF ATTACHBROWSER(wb,GETSTARTPATH+"SimpleSample.pdf") = -1 MESSAGEBOX wb,"Couldn't create browser control","Error" END ENDIF 'Normal Browser command: BROWSECMD wb,@NAVIGATE,"http://www.google.com" 'BROWSECMD wb,@NAVIGATE,"res://"+GETSTARTPATH+"SimpleSample.pdf" BROWSECMD wb,@NAVIGATE,GETSTARTPATH+"SimpleSample.pdf" ''NOTES: ' The Resource file must reflect the correct path used on other machines, ' so it will need to be changed before this will work. ' In the resource dialog, HTML and PDF Files are added as type "Custom", with a ' "Custom Type" of 2110 (See image in zip file as example) ' I've always used the actual name of the file as a resource ID run = 1 waituntil run=0 closedialog urldlg closewindow wb end SUB main(),INT SELECT @CLASS CASE @IDCLOSEWINDOW run = 0 'once the browser gets to a page 'show the current location URL in the edit control CASE @IDNAVCOMPLETE ENDSELECT RETURN 0 ENDSUB SUB handler(),INT SELECT @CLASS CASE @IDCONTROL IF @CONTROLID = 1 BROWSECMD wb,@NAVIGATE,GETCONTROLTEXT(urldlg,2) ENDIF IF @CONTROLID = 4 BROWSECMD wb,@BROWSEPRINT ENDIF CASE @IDCLOSEWINDOW run = 0 'size the embedded browser when the dialog is resized CASE @IDSIZE GETSIZE(urldlg,x,y,w,h) 'here we test for the browser window to make 'sure it has been created before we try to size it. IF (wb <> 0) x = 0 y = 0 h = h - 0 w = w - 0 SETSIZE(wb,x,y,w,h) ENDIF ENDSELECT RETURN 0 ENDSUB