run browser with svg 
Author Message
 run browser with svg

Hi,

I have written a program in FD which called a browser to display html
documents.
The program uses run-application to run the iexplorer.
This has worked till now. The browser doesn't react any more, however, if I
embed a SVG document.
The side is opened correctly if I open them from the MS Exporer or start
from a console, but not via run-application.
Does anybody have an idea where my fault lies in or how could i make a
workaround?

Thanks,

Benno

define method run-browser (#key file, browser)
  block ()
    unless (browser) browser := "c:\\Programme\\Internet
Explorer\\iexplore.exe";
    if (file-exists?(browser-file))
      let command = concatenate(browser, " ", file | "");
      run-application(command);
    else
      notify-user("Browser konnte nicht gefunden werden",
                  title: "Fico [Hinweis]",
                  style: #"warning");
    end if;
  exception (exception :: <condition>)
    fico-signal (exception);
  end block;
end method;

Example:

run-browser(file: "D:\\Benno\\tmp\\test.html");

test.html:

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN">
<HTML>
  <HEAD>
    <TITLE>Test</TITLE>
  </HEAD>
<BODY>
  <!-- works --> <IMG SRC="BPG.BMP">
  <!-- does not work from run-application --> <EMBED TYPE="image/svg+xml"
SRC="diagramm.svg" WIDTH="600" HEIGHT="600">
  <!-- works --> <EMBED  WIDTH="600" HEIGHT="600" SRC="verdi.pdf">
</HTML>



Wed, 31 Aug 2005 00:57:41 GMT  
 run browser with svg
Hi Benno,

I can't help with your problem, but if you want to display SVG and
HTML in FD I have libraries to do this at:

http://www.double.co.nz/dylan/libraries/dylanlibs/index.htm

There are examples there of displaying SVG in DUIM panes, etc.

Chris.



Wed, 31 Aug 2005 10:49:45 GMT  
 run browser with svg
Thank you for your hint.
My program generates html-files with embedded svg-diagrams, so I have
downloaded some of your  libraries for embedding the msie-browser  (calling
the svg-viewer is not sufficient). Your program "simple web browser" works
fine. Great. The HTML files with embedded SVG diagrams can correctly be
opened about the address field. This could become a very nice solution for
my application.
I still hesitate at the moment, however, to go this way, because the size of
my program would grow from 8.7 MB to 11.4 MB. The size seems critical to me
at present, because it is started from a server about a slow net connection
and most of my colleagues have slow computers. (Also I don't know yet to
implement a push-button for opening the print-dialog.)

Thanks,
Benno



Quote:
> Hi Benno,

> I can't help with your problem, but if you want to display SVG and
> HTML in FD I have libraries to do this at:

> http://www.double.co.nz/dylan/libraries/dylanlibs/index.htm

> There are examples there of displaying SVG in DUIM panes, etc.

> Chris.



Fri, 02 Sep 2005 00:39:33 GMT  
 run browser with svg

Quote:

> I still hesitate at the moment, however, to go this way, because the
> size of my program would grow from 8.7 MB to 11.4 MB.

Does that include the Dylan runtime library? If so, at least that only
needs to be downloaded once and any application updates should be
smaller.

Quote:
> (Also I don't know yet to implement a push-button for opening the
> print-dialog.)

If you are talking about printing the HTML document then there is an
ExecWB method on the <IWebBrowser2> interface that will do the
job. Something like:

  let wb :: <iwebbrowser2> = ...;
  ExecWB(wb, $OLECMDID-PRINT, 0, 0, 0);

(This is untested, but the basic idea is to use ExecWB as per
 http://msdn.microsoft.com/library/default.asp?url=/workshop/browser/w...)

Chris.
--
http://www.double.co.nz/dylan



Fri, 02 Sep 2005 08:53:52 GMT  
 run browser with svg



Quote:

> > I still hesitate at the moment, however, to go this way, because the
> > size of my program would grow from 8.7 MB to 11.4 MB.

> Does that include the Dylan runtime library?

Yes.

Quote:
> If so, at least that only
> needs to be downloaded once and any application updates should be
> smaller.

I don't know how DLL loading is organized, which paths are searched in which
order.
The FD descriptions to the Redistribution don't help me. They are no longer
valid, apparently.
At present, our file server hosts my programm with all DLLs (my own, those
of the Dylan runtime library, and the central database (a dood application).
If I want to make program extensions or bug fixes, I copy the new DLLs into
the application directory (working directory) at the file server. My
colleagues (i.e. the users) always call my program from the file server and
so always have the actual program version.
The start takes at present approx. 8-12 seconds to display the "login" mask,
then again approx.
2-4 seconds to display the main menu.  In this case it would be probably
more favorable only to load the application specific libraries from the
server, and load the dylan runtime libraries from the local hard disks. This
should be possible. Is it? If yes, how? Have I only to change an OS
variable, which tells the operating system, where the runtime libraries
could be found? If yes, which variable? If no, what else?

Quote:
> > (Also I don't know yet to implement a push-button for opening the
> > print-dialog.)

> If you are talking about printing the HTML document then there is an
> ExecWB method on the <IWebBrowser2> interface that will do the
> job. Something like:

>   let wb :: <iwebbrowser2> = ...;
>   ExecWB(wb, $OLECMDID-PRINT, 0, 0, 0);

> (This is untested, but the basic idea is to use ExecWB as per

http://msdn.microsoft.com/library/default.asp?url=/workshop/browser/w...
er/tutorials/wbtutorial.asp)

I will try to test this but I haven't been able to find any instance of the
interface class <iwebbrowser2> till now in your simple web browser
application.

Regards,
Benno



Sat, 03 Sep 2005 04:49:03 GMT  
 run browser with svg

Quote:

> In this case it would be probably more favorable only to load the
> application specific libraries from the server, and load the dylan
> runtime libraries from the local hard disks. This should be
> possible. Is it? If yes, how? Have I only to change an OS variable,
> which tells the operating system, where the runtime libraries could
> be found? If yes, which variable? If no, what else?

You can copy any DLL on to a directory in the PATH environment
variable. So if you have DLL's that don't change (either runtime
library or application libraries that you don't modify) place them
somewhere on the local drive and add them to the users PATH. eg:

  PATH=%PATH%;c:\dylan_dlls

Quote:
> I will try to test this but I haven't been able to find any instance of the
> interface class <iwebbrowser2> till now in your simple web browser
> application.

Sorry, I was looking at the wrong example. Call atl-activex-interface
on the <msie-gadget>. This returns an <iwebbrowser2>
instance. Basically follow similar code to on-go-button. Something
like (again, untested):

  define method on-go-button(g)
    let browser-gadget = g.sheet-frame.browser-pane;
    let-com-interface html-control = browser-gadget.atl-activex-interface;
    let-resource optional :: <lpvariant> = make(<lpvariant>);
    IWebBrowser2/ExecWB(html-control, $OLECMDID-PRINT, 0, optional, optional);
  end method on-go-button;

Chris.
--
http://www.double.co.nz/dylan



Sat, 03 Sep 2005 05:54:31 GMT  
 run browser with svg
I have tried to extend your simple web browser with this code:

define method on-print-button(g)
  let browser-gadget = g.sheet-frame.browser-pane;
  let-com-interface html-control = browser-gadget.atl-activex-interface;
  let-resource optional :: <lpvariant> = make(<lpvariant>);
  //let-resource optional2 :: <ole-arg-spec> = make(<ole-arg-spec>);
  //IWebBrowser2/ExecWB(html-control, $OLECMDID-PRINT, 0, optional,
optional2);
  IWebBrowser2/ExecWB(html-control, $OLECMDID-PRINT, 0, optional, optional);
end method on-print-button;

But the compilation fails:

Serious warning at simple-web-browser:68:
Invalid type for argument arg-pvaOut in call to method IWebBrowser2/ExecWB
(this :: <IWebBrowser2>,
arg-cmdID :: #P{ dylan-automation-type-macro(<olecmdid>) },
arg-cmdexecopt :: #P{ dylan-automation-type-macro(<olecmdexecopt>) },
arg-pvaIn :: #P{ dylan-automation-type-macro(<variant*>) },
arg-pvaOut :: #P{ dylan-automation-type-macro(inout-ref (<variant>)) },
#next next-method :: <object>) => ():
<lpvariant> supplied, <ole-arg-spec> expected.
simple-web-browser:67: -----------------------------------------------------
--------------------
simple-web-browser:68: IWebBrowser2/ExecWB(html-control, $OLECMDID-PRINT, 0,
optional, optional);
simple-web-browser:69: -----------------------------------------------------
-------------

The function WebBrowser2/ExecWB expects obviously that the last argument for
calling the print routines to be of the type <ole-arg-spec>. Unfortunately,
I don't have knowledge over the OLE library, so i don't know how I can
arrange that.

The following example is found in the MS Tutorial.
//This code snippet prints the contents of the WebBrowser control
//after displaying a print dialog box.
m_browser.ExecWB(OLECMDID_PRINT, 0, NULL, NULL);

This raises two questions for me. How are C/C++ NULL values encoded in the
OLE library? Why does the FD compiler expect two different argument types
although in the MS example NULL is submitted twice?

Thanks,
Benno



Quote:

> > In this case it would be probably more favorable only to load the
> > application specific libraries from the server, and load the dylan
> > runtime libraries from the local hard disks. This should be
> > possible. Is it? If yes, how? Have I only to change an OS variable,
> > which tells the operating system, where the runtime libraries could
> > be found? If yes, which variable? If no, what else?

> You can copy any DLL on to a directory in the PATH environment
> variable. So if you have DLL's that don't change (either runtime
> library or application libraries that you don't modify) place them
> somewhere on the local drive and add them to the users PATH. eg:

>   PATH=%PATH%;c:\dylan_dlls

> > I will try to test this but I haven't been able to find any instance of
the
> > interface class <iwebbrowser2> till now in your simple web browser
> > application.

> Sorry, I was looking at the wrong example. Call atl-activex-interface
> on the <msie-gadget>. This returns an <iwebbrowser2>
> instance. Basically follow similar code to on-go-button. Something
> like (again, untested):

>   define method on-go-button(g)
>     let browser-gadget = g.sheet-frame.browser-pane;
>     let-com-interface html-control = browser-gadget.atl-activex-interface;
>     let-resource optional :: <lpvariant> = make(<lpvariant>);
>     IWebBrowser2/ExecWB(html-control, $OLECMDID-PRINT, 0, optional,
optional);
>   end method on-go-button;

> Chris.
> --
> http://www.double.co.nz/dylan



Sun, 04 Sep 2005 05:06:21 GMT  
 run browser with svg

Quote:

> The following example is found in the MS Tutorial.
> //This code snippet prints the contents of the WebBrowser control
> //after displaying a print dialog box.
> m_browser.ExecWB(OLECMDID_PRINT, 0, NULL, NULL);

> This raises two questions for me. How are C/C++ NULL values encoded in the
> OLE library? Why does the FD compiler expect two different argument types
> although in the MS example NULL is submitted twice?

In the Dylan C-FFI null pointers still need to be 'typed'
correctly. So you need something like:

  IWebBrowser2/ExecWB(
     html-control,
     $OLECMDID-PRINT,
     0,
     optional,  
     null-pointer(<ole-arg-spec>));

I can't test it at the moment. It may not be null-pointer but it's
something like that anywany. Another option is:

  let optional2 = make(<ole-arg-spec>, pointer-value: 0);

Or something like that.

Chris.



Sun, 04 Sep 2005 05:46:32 GMT  
 run browser with svg
Your second idea works with a small addition.

   let optional2 = make(<ole-arg-spec>, pointer-value: 0, value: 0)

Without value: 0 fd signals an application error:

   Dylan error: Must specify one of vt:, type:, or value: for <ole-arg-spec>

I will integrate your browser libraries in the new release of my program.
A flaw only is, that the print call leads to use the default print template
of the msie. The CSS directives for footer and header are ignored by msie.
(I don't want to print the url etc.) MS itself points to these restriction
as well as options for the implementation of print templates. However, this
is a further chapter (and not my domain).

Again many thanks for your help

Benno



Quote:

> > The following example is found in the MS Tutorial.
> > //This code snippet prints the contents of the WebBrowser control
> > //after displaying a print dialog box.
> > m_browser.ExecWB(OLECMDID_PRINT, 0, NULL, NULL);

> > This raises two questions for me. How are C/C++ NULL values encoded in
the
> > OLE library? Why does the FD compiler expect two different argument
types
> > although in the MS example NULL is submitted twice?

> In the Dylan C-FFI null pointers still need to be 'typed'
> correctly. So you need something like:

>   IWebBrowser2/ExecWB(
>      html-control,
>      $OLECMDID-PRINT,
>      0,
>      optional,
>      null-pointer(<ole-arg-spec>));

> I can't test it at the moment. It may not be null-pointer but it's
> something like that anywany. Another option is:

>   let optional2 = make(<ole-arg-spec>, pointer-value: 0);

> Or something like that.

> Chris.



Mon, 05 Sep 2005 04:58:06 GMT  
 
 [ 9 post ] 

 Relevant Pages 

1. Browsers, browsers, browsers

2. App running in browser works sometimes

3. ANN: Run Smalltalk Bytecodes in a Browser!

4. Run Clarion Programs Inside Of IE4 Browser

5. Run time error(GPF) with WEB Browser OCX

6. which VRML browser runs on IE 4.0

7. Run Ada ActiveX objects in your browser

8. cannot run makepy or COM browser

9. looking for library function browser to run inside (x)emacs

10. os.popen results differ run by browser vs DOS prompt

11. os.popen results differ when run in browser and DOS level

12. Finding the favourite HTML browser to run.

 

 
Powered by phpBB® Forum Software