Jump to content
saeiddavoody

Problem with EmbeddedWB in Delphi 12

Recommended Posts

Hi,

I had installed the EmbeddedWB component on Delphi 10.4 . It had worked successfully both on 32bit and 64bit application. Now I ported the component to Delphi 12.2. It works on 32bit application but on 64bit, when the EmbeddedWB1.Navigate statement runs, the application crashes and closes.


What are the changes on WebBrowser since Delphi 10.4 to 12? And How should I found and fix the problem?

EmbeddedWB-Delphi12.rar

Edited by saeiddavoody

Share this post


Link to post

This is a works derived from old github repository. Most of the definitions are included in new IDE (like SHDocVw of IDE that have more complete defines).

 

For example, this is something differents:

 

Embedded define from SHDocVw_EWB (look var PostData):

image.thumb.png.cbe3d94a3139c30ede904fee19981768.png

 

IDE define from SHDocVw (look const PostData):

image.thumb.png.c51a396e86c78f2fb81cdc274b39ab30.png 

 

Since those project come from very old one, I think it's really difficult to define what is the issue: the lack of source code for your app, related to how you use the component, then does not help.

Share this post


Link to post
42 minutes ago, DelphiUdIT said:

This is a works derived from old github repository. Most of the definitions are included in new IDE (like SHDocVw of IDE that have more complete defines).

 

For example, this is something differents:

 

Embedded define from SHDocVw_EWB (look var PostData):

image.thumb.png.cbe3d94a3139c30ede904fee19981768.png

 

IDE define from SHDocVw (look const PostData):

image.thumb.png.c51a396e86c78f2fb81cdc274b39ab30.png 

 

Since those project come from very old one, I think it's really difficult to define what is the issue: the lack of source code for your app, related to how you use the component, then does not help.

Thank you for answer, My sample project has only one statement without any other codes. Please see the attached sample. On 32bit platform there is no any problem. The problem is only in 64bit.

WebBrowser2.rar

Edited by saeiddavoody

Share this post


Link to post

EDIT: READ NEXT POST

 

I try to debug it, but something goes wrong in the source (compiled system unit) of IDE.

 

There is no chance (or better I was not able) to let it works or diagnose what is the problem. The only thing that I catch is that is generated an error (0xc000041d), in Microsoft  that means:

 

image.thumb.png.9baf0d25d0ffe8223d94304207d09a3d.png

 

Link in Italian: https://support.microsoft.com/it-it/topic/errore-ntstatus-0xc000041d-si-verifica-quando-si-fa-clic-su-un-collegamento-in-un-applicazione-basata-sul-web-in-internet-explorer-10-in-windows-8-o-windows-server-2012-49b8cfdd-a841-06ce-ae60-8c04ff74a2f3

 

If you use the IDE standard component TWebBrowser all works.

Edited by DelphiUdIT

Share this post


Link to post

UPDATE:

 

IT WORKS DOING SO:

image.thumb.png.186c16293896f6a2282e08f23e1a5066.png

 

But this is only an "escamotage" because this means that in your components there are something not working with WIN64 convention ... normally are the pointers ...

 

Edited by DelphiUdIT

Share this post


Link to post
6 minutes ago, DelphiUdIT said:

UPDATE:

 

IT WORKS DOING SO:

image.thumb.png.186c16293896f6a2282e08f23e1a5066.png

 

But this is only an "escamotage" because this means that in your components ther are something not workin with WIN64 convention ... normally is the pointers ...

 

Probably the problem is related to the changes made in Delphi 12 or 11, because it works correctly in Delphi 10.4 even on the 64-bit platform.

Edited by saeiddavoody

Share this post


Link to post
14 minutes ago, saeiddavoody said:

Probably the problem is related to the changes made in Delphi 12 or 11, because it works correctly in Delphi 10.4 even on the 64-bit platform.

The changes that were done are the enable of ASLR and High LOAD in all projects (old and news).

 

WIthout this the component works, OR BETTER SEEM TO WORKS. Don't put you hand over the fire about this.

 

Like I told the component is derived from very old projects, and it's near the true that is not "fully" compatible with x64 tech.

 

The full project should be take in care and updated to x64, looking everywhere in the code.

 

EDIT: to better explain, in the x32 the pointers are 4 bytes long, where in x64 are 8 bytes. If you don't use the "high memory" is possible that all works ... but really always ?

 

Look there: https://docwiki.embarcadero.com/RADStudio/Athens/en/Converting_32-bit_Delphi_Applications_to_64-bit_Windows

Edited by DelphiUdIT

Share this post


Link to post
16 minutes ago, saeiddavoody said:

Probably the problem is related to the changes made in Delphi 12 or 11, because it works correctly in Delphi 10.4 even on the 64-bit platform.

Put those two define lines in a DPR file of your application after "program" section in 10.4 and buld it with x64:

 

program ..............;

{$SETPEOPTFLAGS $40}       //SET ALSR ON (Address space layout randomization
{$SETPEOPTFLAGS $020}      //SET HEVA ON (HIGH ENTROPY VA)

You will see (should) the same issue.

Share this post


Link to post
4 hours ago, saeiddavoody said:

Hi,

I had installed the EmbeddedWB component on Delphi 10.4 . It had worked successfully both on 32bit and 64bit application. Now I ported the component to Delphi 12.2. It works on 32bit application but on 64bit, when the EmbeddedWB1.Navigate statement runs, the application crashes and closes.


What are the changes on WebBrowser since Delphi 10.4 to 12? And How should I found and fix the problem?

EmbeddedWB-Delphi12.rar

Can you not just ditch it and use TEdgeBrowser supplied with Delphi instead?

Share this post


Link to post

Indeed, the EmbeddedWB component wraps the old Internet Explorer stuff which is long obsoleted by Edge, it still works for Microsoft APIs, but not for Google APIs, you need to use Edge.

 

Angus

 

Share this post


Link to post
3 hours ago, PeterBelow said:

Can you not just ditch it and use TEdgeBrowser supplied with Delphi instead?

My project is a bit old and relatively large. I have written many functions and codes related to EmbeddedWB. Replacing TEdgeBrowser takes a long time. Of course, I will do this in the future, but I don't have the time now.

Share this post


Link to post

I have the same problem with EmbeddedWB. There is something bad in the component initialization code, because application start crashing after you add just one EmbeddedWB unit to your uses list.

 

unit Unit1;

interface

uses
  Winapi.Windows, Winapi.Messages, System.Variants, System.Classes, Vcl.Graphics,
  Vcl.Controls, Vcl.Forms, Vcl.Dialogs, Vcl.StdCtrls, Vcl.OleCtrls,
  EmbeddedWB, // !!!
  System.SysUtils;

type
  TForm1 = class(TForm)
    Button1: TButton;
    procedure Button1Click(Sender: TObject);
  end;

var
  Form1: TForm1;

implementation

{$R *.dfm}

procedure TForm1.Button1Click(Sender: TObject);
begin
//  var EmbeddedWB1 := TEmbeddedWB.Create(Self);
//  EmbeddedWB1.Navigate(ExtractFilePath(Application.ExeName)+ '..\..\test.htm');
end;

end.

 

Share this post


Link to post
1 hour ago, zed said:

I found it!

Function SetWindowLong must be replaced with SetWindowLongPtr with proper type cast.

Function GetWindowLong must be replaced with GetWindowLongPtr.

Hi, Do you install and test the updated component in 64 bit platform? It seems that there are some problems yet.

Share this post


Link to post

No, I don't use it in the IDE at design time. I create EWB at runtime and it seems to work fine.

Edited by zed

Share this post


Link to post
On 11/9/2024 at 9:27 AM, PeterBelow said:

Can you not just ditch it and use TEdgeBrowser supplied with Delphi instead?

Much easier said than done if you have a large legacy application built around Trident. If you are using a lot of synchronous javascript calls the refactoring job to work in the asynchronous Edge browser is no small refactoring task.

 

Obviously it would be a worthwhile thing to do, IMO, but of course that needs to be balance against other concerns...

Share this post


Link to post

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×