1. Thierry Del Fiore
  2. PowerBuilder
  3. Thursday, 27 January 2022 14:14 PM UTC

HI,

Version PB2019R2

We used to work with an U_web_browser to display local PDF files in our app.

Now, we need to display HTML pages -> so in order to support Javascript we tried to move to the new webbrower control.

Everything works fine in PB sources, we can display both PDF local files and HTML pages.

But in the executable version, the control displays only blank pages.

we have delivered the pbcef190 subfolder and the pbwebbrowser190.dll.

It doesn't work on users PC and even if the executable runs on the dev PC.

What are we missing ? Is this a PB2019R2 bug ?

Best Regards

Chris Pollach @Appeon Accepted Answer Pending Moderation
  1. Thursday, 3 February 2022 19:04 PM UTC
  2. PowerBuilder
  3. # 1

Hi Thierry;

   FWIW: Here is what I use in my STD framework ...

INI file:

;  ----- Start Web Browser Control Settings Section. ----
[Browser Template]
CachePath=                    ; The folder that stores the web page cache, cookies etc.
UserDataPath=                ; The folder that stores the user data dictionary.
DownloadPath=               ; The default download path.
UserAgent=AppeonWebBrowser        ; The User-Agent request header
ProxyAuto=1                  ; Whether to use auto proxy detection (default 1=yes)
ProxyPacUrl=                  ; The URL of the server where the PAC file is located.
ProxyAddress=                ; The address of the proxy server.
ProxyPort=                     ; The port of the proxy server.
ProxyUser=                     ; The user name that will be authenticated by the proxy server.
ProxyPassword=              ; The password that will be authenticated by the proxy server.
RemoteDebuggingPort=6124      ; The remote debugging port used by AscentialTest (default 6124)

 

PowerScript:

global type fn_web_browser_control_settings from function_object
end type

forward prototypes
global subroutine fn_web_browser_control_settings (string as_ini_name, string as_section_name)
end prototypes

global subroutine fn_web_browser_control_settings (string as_ini_name, string as_section_name);/*
Method				:  (Global Function)
Author				: Chris Pollach
Scope  				: Public
Extended			: No
Level					: Base

Description			: Called to set the App's Web Browser Control settings
Behaviour			: Will be used for all instances of the WB Control
Note					: 

 New PB2019 R2 Web Briowser Control "Proxy" settings ...
 Path settings:
	CachePath 																				// The folder that stores the web page cache, cookies etc.
	UserDataPath 																			//  The folder that stores the user data dictionary.
	DownloadPath																			//  The default download path.
User agent settings:
	UserAgent																				// The User-Agent request header
Proxy settings:
	ProxyAuto	= "1"																		// Whether to use auto proxy detection( default 1=yes)
	ProxyPacUrl 																			// The URL of the server where the PAC file is located.
	ProxyAddress 																			// The address of the proxy server.
	ProxyPort 																				// The port of the proxy server.
	ProxyUser																				// The user name that will be authenticated by the proxy server.
	ProxyPassword 																		// The password that will be authenticated by the proxy server.

Argument(s)		: None
Throws				: N/A

Return Value		: None

--------------------------------------------  CopyRight -----------------------------------------------------
Copyright © 2020 by Software Tool & Die Inc, here in known as STD Inc. All rights reserved.
Any distribution of the STD Foundation Classes (STD_FC) for PowerBuilder®, InfoMaker®,
PowerServer Web® or PowerServer Mobile® source code by other than by STD Inc. is prohibited.
-------------------------------------------  Revisions -------------------------------------------------------
1.0 	Inital Version																						-	2020-09-25
1.1	Added code to log changes if in DEBUG mode												-	2021-01-08
1.2	Added a set "remote-debugging-port" to allow AscentialTest to work with App		-	2021-04-01
*/

// Declarations

Integer	li_rc																								// RC work Var

// Web Browser property settings work variables ...
String		ls_CachePath
String		ls_downloadpath
String		ls_proxyaddress
String		ls_proxyauto
String		ls_proxypacurl
String		ls_proxypassword
String		ls_proxyport
String		ls_proxyuser
String		ls_useragent
String		ls_userdatapath
String		ls_port
String		ls_msg
String		ls_title
String		ls_class
sr_pass_data	lo_sr


// Read INI values from App's INI file ...
ls_CachePath 		=	ProFileString ( as_ini_name , as_section_name , "CachePath", "" )					// Get CachePath
ls_downloadpath	=	ProFileString ( as_ini_name , as_section_name , "DownLoadPath", "" )			// Get DownLoadPath
ls_proxyaddress	=	ProFileString ( as_ini_name , as_section_name , "ProxyAddress", "" )				// Get ProxyAddress
ls_proxyauto		=	ProFileString ( as_ini_name , as_section_name , "ProxyAuto", "" )					// Get ProxyAuto
ls_proxypacurl		=	ProFileString ( as_ini_name , as_section_name , "ProxyPacUrl", "" )				// Get ProxyPacUrl
ls_proxypassword	=	ProFileString ( as_ini_name , as_section_name , "ProxyPassword", "" )			// Get ProxyPassword
ls_proxyport		=	ProFileString ( as_ini_name , as_section_name , "ProxyPort", "" )					// Get ProxyPort
ls_proxyuser		=	ProFileString ( as_ini_name , as_section_name , "ProxyUser", "" )					// Get ProxyUser
ls_useragent		=	ProFileString ( as_ini_name , as_section_name , "UserAgent", "" )					// Get UserAgent
ls_userdatapath	=	ProFileString ( as_ini_name , as_section_name , "UserDataPath", "" )				// Get UserDataPath
ls_port				=	ProFileString ( as_ini_name , as_section_name , "RemoteDebuggingPort", "" )	// Get Debugging Port#

// Process Setting updates and Apply if supplied ... 
IF  Len ( ls_CachePath ) > 0 THEN
	li_rc	=	WebBrowserset ( "CachePath", ls_CachePath )
	IF  go_ac.of_is_debug_mode( ) = TRUE  THEN
		lo_sr.si_data [ 1 ] 	=	ls_class
		lo_sr.si_data [ 2 ] 	=	"CachePath"
		lo_sr.si_data [ 3 ] 	=	ls_CachePath
		go_ac.of_get_message( 133, ls_title, ls_msg, lo_sr )
		go_ac.of_write_log ( ls_msg )
	END IF	
END IF
IF  Len ( ls_DownLoadPath ) > 0 THEN
	li_rc	=	WebBrowserset ( "DownLoadPath", ls_DownLoadPath )	
	IF  go_ac.of_is_debug_mode( ) = TRUE  THEN
		lo_sr.si_data [ 1 ] 	=	ls_class		
		lo_sr.si_data [ 2 ] 	=	"DownLoadPath" 
		lo_sr.si_data [ 3 ] 	=	ls_DownLoadPath
		go_ac.of_get_message( 133, ls_title, ls_msg, lo_sr )
		go_ac.of_write_log ( ls_msg )
	END IF	
END IF
IF  Len ( ls_ProxyAddress ) > 0 THEN
	li_rc	=	WebBrowserset ( "ProxyAddress", ls_ProxyAddress )
	IF  go_ac.of_is_debug_mode( ) = TRUE  THEN
		lo_sr.si_data [ 1 ] 	=	ls_class		
		lo_sr.si_data [ 2 ] 	=	"ProxyAddress"
		lo_sr.si_data [ 3 ] 	=	ls_ProxyAddress
		go_ac.of_get_message( 133, ls_title, ls_msg, lo_sr )
		go_ac.of_write_log ( ls_msg )
	END IF		
END IF
IF  Len ( ls_ProxyAuto ) > 0 THEN
	li_rc	=	WebBrowserset ( "ProxyAuto", ls_ProxyAuto )	
	IF  go_ac.of_is_debug_mode( ) = TRUE  THEN
		lo_sr.si_data [ 1 ] 	=	ls_class
		lo_sr.si_data [ 2 ] 	=	"ProxyAuto"
		lo_sr.si_data [ 3 ] 	=	ls_ProxyAuto
		go_ac.of_get_message( 133, ls_title, ls_msg, lo_sr )
		go_ac.of_write_log ( ls_msg )
	END IF			
END IF
IF  Len ( ls_ProxyPacUrl ) > 0 THEN
	li_rc	=	WebBrowserset ( "ProxyPacUrl", ls_ProxyPacUrl )
	IF  go_ac.of_is_debug_mode( ) = TRUE  THEN
		lo_sr.si_data [ 1 ] 	=	ls_class		
		lo_sr.si_data [ 2 ] 	=	"ProxyPacUrl"
		lo_sr.si_data [ 3 ] 	=	ls_ProxyPacUrl
		go_ac.of_get_message( 133, ls_title, ls_msg, lo_sr )
		go_ac.of_write_log ( ls_msg )
	END IF		
END IF
IF  Len ( ls_ProxyPassword ) > 0 THEN
	li_rc	=	WebBrowserset ( "ProxyPassword", ls_ProxyPassword )	
	IF  go_ac.of_is_debug_mode( ) = TRUE  THEN
		lo_sr.si_data [ 1 ] 	=	ls_class		
		lo_sr.si_data [ 2 ] 	=	"ProxyPassword" 
		lo_sr.si_data [ 3 ] 	=	ls_ProxyPassword
		go_ac.of_get_message( 133, ls_title, ls_msg, lo_sr )
		go_ac.of_write_log ( ls_msg )
	END IF	
END IF
IF  Len ( ls_ProxyPort ) > 0 THEN
	li_rc	=	WebBrowserset ( "ProxyPort", ls_ProxyPort )
	IF  go_ac.of_is_debug_mode( ) = TRUE  THEN
		lo_sr.si_data [ 1 ] 	=	ls_class		
		lo_sr.si_data [ 2 ] 	=	"ProxyPort"
		lo_sr.si_data [ 3 ] 	=	ls_ProxyPort 
		go_ac.of_get_message( 133, ls_title, ls_msg, lo_sr )
		go_ac.of_write_log ( ls_msg )
	END IF	
END IF
IF  Len ( ls_ProxyUser ) > 0 THEN
	li_rc	=	WebBrowserset ( "ProxyUser", ls_ProxyUser )	
	IF  go_ac.of_is_debug_mode( ) = TRUE  THEN
		lo_sr.si_data [ 1 ] 	=	ls_class		
		lo_sr.si_data [ 2 ] 	=	"ProxyUser" 
		lo_sr.si_data [ 3 ] 	=	ls_ProxyUser 
		go_ac.of_get_message( 133, ls_title, ls_msg, lo_sr )
		go_ac.of_write_log ( ls_msg )
	END IF		
END IF
IF  Len ( ls_UserAgent ) > 0 THEN
	li_rc	=	WebBrowserset ( "UserAgent", ls_UserAgent )
	IF  go_ac.of_is_debug_mode( ) = TRUE  THEN
		lo_sr.si_data [ 1 ] 	=	ls_class		
		lo_sr.si_data [ 2 ] 	=	"UserAgent" 
		lo_sr.si_data [ 3 ] 	=	ls_UserAgent  
		go_ac.of_get_message( 133, ls_title, ls_msg, lo_sr )
		go_ac.of_write_log ( ls_msg )
	END IF		
END IF
IF  Len ( ls_UserDataPath ) > 0 THEN
	li_rc	=	WebBrowserset ( "UserDataPath", ls_UserDataPath )
	IF  go_ac.of_is_debug_mode( ) = TRUE  THEN
		lo_sr.si_data [ 1 ] 	=	ls_class		
		lo_sr.si_data [ 2 ] 	=	"UserDataPath" 
		lo_sr.si_data [ 3 ] 	=	ls_UserDataPath  
		go_ac.of_get_message( 133, ls_title, ls_msg, lo_sr )
		go_ac.of_write_log ( ls_msg )
	END IF		
END IF
IF go_ac.of_is_debug_mode( ) = TRUE THEN
	String	ls_key	=	"remote-debugging-port"
	li_rc	=	WebBrowserset ( ls_key, ls_port )
	lo_sr.si_data [ 1 ] 	=	ls_class	
	lo_sr.si_data [ 2 ] 	=	ls_key
	lo_sr.si_data [ 3 ] 	=	ls_port
	go_ac.of_get_message( 133, ls_title, ls_msg, lo_sr )
	go_ac.of_write_log ( ls_msg )	
END IF

RETURN 																							// Return  To caller 
end subroutine

HTH

Regards ... Chris

Comment
  1. Miguel Leeuwe
  2. Thursday, 3 February 2022 19:08 PM UTC
Nice!
  1. Helpful
There are no comments made yet.
Armeen Mazda @Appeon Accepted Answer Pending Moderation
  1. Thursday, 27 January 2022 14:32 PM UTC
  2. PowerBuilder
  3. # 2

If it works fine on dev PC I don’t see how this could be a bug.   Likely it is environment/config issue.  

The obvious first thing to check is all necessary runtime DLLs deployed, which you say is taken care of.  But what about  the dependent DLLs: chrome_elf.dll, d3dcompiler_43.dll, d3dcompiler_47.dll, libEGL.dll, libGLESv2.dll, libcef.dll, swiftshader/libEGL.dll, swiftshader/libGLESv2.dll?

Then I would suggest running the app as administrator and disabling anti-virus software on the problematic machine to rule out security config blocking it.

Comment
  1. Chris Pollach @Appeon
  2. Thursday, 27 January 2022 14:59 PM UTC
In Addition to Armeen's comments, please try ...

1) Use the PB Packager utility to deploy the PB runtime. In there, just make sue that you check the extra PB features that your App is using (ie: Web Browser) and this utility will take care of all the necessary runtime DLL packaging.

2) Use the PB help. Search for the keyword "runtime". Then follow the link "List of runtime files". This will give you a manual check list of what DLL's to manually copy over to the deployment machine.
  1. Helpful
  1. Thierry Del Fiore
  2. Thursday, 27 January 2022 15:20 PM UTC
Hi Chris,

That's what I did. I used the "Runtime Packager" - with "Webbrower control support" .

All these dll's are well delivered with our executable (they are copied in the executable folder, we didn't use the .msi install).



pbwebbrowser190.dll (and its dependent DLLs: chrome_elf.dll, d3dcompiler_43.dll, d3dcompiler_47.dll, libEGL.dll, libGLESv2.dll, libcef.dll, swiftshader/libEGL.dll, swiftshader/libGLESv2.dll) (and "pbcef190" folder)



The dependent DLL's are in the "pbcef190" subfolder of the executable (if i move them to the main folder, the application crash with minidump files creation).



Even if a file was missing in the user PC, it should work on the dev PC where PB is installed and this is not the case.

Am I Wrong ?
  1. Helpful
  1. Miguel Leeuwe
  2. Thursday, 27 January 2022 21:13 PM UTC
What if you add the cef folder to the windows PATH variable? I'm thinking maybe opening up some pdf from a different path, might change your current internal windows folder and loose track of where the CEF folder is.
  1. Helpful
There are no comments made yet.
Miguel Leeuwe Accepted Answer Pending Moderation
  1. Thursday, 27 January 2022 16:02 PM UTC
  2. PowerBuilder
  3. # 3

I'd definitely recommend upgrading to the latest R3 build. The webbrowser behaves better in R3.

Comment
There are no comments made yet.
Miguel Leeuwe Accepted Answer Pending Moderation
  1. Thursday, 27 January 2022 17:24 PM UTC
  2. PowerBuilder
  3. # 4

There is some code that you might want to put in the open event of your application object. Please read this post:

https://community.appeon.com/index.php/qna/q-a/crash-with-webbrowser-powerbuilder-2019?limitstart=0#reply-31655

Hopefully it helps,

regards

MiguelL

Comment
  1. Thierry Del Fiore
  2. Thursday, 3 February 2022 16:00 PM UTC
Hi Miguel,



Indeed, by inserting this code in the open even, tbe WebBrowser is working and displays both PDF and HTML pages.

I don't know what's this script stands for, but it solved the issue.



Thanks



// seems to be a necessary setting for CEF webbrowser control:

int li_ret

string ls_ret

li_ret = WebBrowserGet("UserAgent", ref ls_ret)

if ls_ret = "" then

li_ret = WebBrowserSet("UserAgent", "AppeonWebBrowser")

if li_ret <> 1 then

Messagebox("Information", "Error setting the UserAgent for the WebBrowser", information!)

end if

end if





  1. Helpful
  1. Miguel Leeuwe
  2. Thursday, 3 February 2022 18:49 PM UTC
YW, I don't really know how to explain the need for that code either. I had a problem one day and one of Appeon's employees told me to use that code, which then solved my problem.

Glad it works, please mark as resolved.

Regards
  1. Helpful
There are no comments made yet.
Thierry Del Fiore Accepted Answer Pending Moderation
  1. Thursday, 27 January 2022 14:55 PM UTC
  2. PowerBuilder
  3. # 5

When i say it works on the dev PC, it's only working in the PB source dev environment -> the compiled version doesn't work neither on users PC, neither on the same Dev PC.

Comment
  1. Brad Mettee
  2. Thursday, 27 January 2022 16:32 PM UTC
What happens if you run the EXE from the development directory directly? It sounds like it's looking for files it can't find (PDF or Datawindow).

How do you compile, all in one EXE, or with PBDs? What's the manifest setting?
  1. Helpful
  1. Chris Pollach @Appeon
  2. Thursday, 27 January 2022 19:04 PM UTC
Great suggestion Brad!
  1. Helpful
  1. Thierry Del Fiore
  2. Friday, 28 January 2022 08:29 AM UTC
Hi,

We compile with EXE + PBD's in 32 bits

Same behaviour when executable in the dev directory -> blank pages.

Even in dev, sometimes the control displays blank pages or crash PB -> we delete it and insert again on the window and it works again.
  1. Helpful
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.