1. Gregory Rusak
  2. PowerBuilder
  3. Wednesday, 11 November 2020 01:57 AM UTC

Hello,

How does one go about opening the user's default web browser and displaying in it HTML source code as a string without having to write the HTML to a temporary File? In other words an in-memory approach.

And what about the new internal Chromium WebBrowser Control? I don't immediately see a method for "loading" an HTML document. Is this possible, or is a file always needed?

PowerBuilder 2019R2

Thanks in advance.

Greg

Miguel Leeuwe Accepted Answer Pending Moderation
  1. Wednesday, 11 November 2020 10:15 AM UTC
  2. PowerBuilder
  3. # 1

use the "shellexecute" windows API.

There a OpenWordDoc.zip file on this page which contains a user object "n_findwindow" to visualize different types of documents. It's used as an example to show a word document, but if you call the function:

of_viewdocument() and pass in the path to an html file on disk, it should be visualized in your windows default browser.

https://community.appeon.com/index.php/qna/q-a/is-the-ms-word-document-open?limitstart=0#reply-23884

Comment
  1. Gregory Rusak
  2. Wednesday, 11 November 2020 17:23 PM UTC
Thanks Miguel,

Your approach still requires a temporary file to be created on disk, which then will need to be deleted. In order to avoid all that, we were looking for a way to directly open the default browser and sending it HTML to render in the display.
  1. Helpful
  1. Miguel Leeuwe
  2. Wednesday, 11 November 2020 17:26 PM UTC
Sorry I misread your initial post where you say "as a string", I only saw "This would be similar to the user saving the HTML PowerScript string as a file".

So ... yeah, I really wouldn't know if that's going to be possible.

Sorry
  1. Helpful
  1. Gregory Rusak
  2. Thursday, 12 November 2020 02:23 AM UTC
Hey Miguel,

After re-reading my initial post, I do see how it can be easily misread. Thanks for that.

Yes, I'm looking for an in-memory approach.
  1. Helpful
There are no comments made yet.
Peter Piechutzki Accepted Answer Pending Moderation
  1. Thursday, 12 November 2020 06:44 AM UTC
  2. PowerBuilder
  3. # 2

Hi Greg,

Just a thought, imho a memory approch wouldn't work, since the browsers I know of all rely on a file or html strem. A workaround might be coming up in PB2019 R3 using the new chromium Web browser control. I don't quite remember the functions, but I assume it may be possible to wrap the string into javascipt code which you then send to the control.

regards

Peter

 

Comment
There are no comments made yet.
  • Page :
  • 1


There are no replies made for this question yet.
However, you are not allowed to reply to this question.