Disclosure Statement: This site contains affiliate links, which means that I may receive a commission if you make a purchase using these links. As an eBay Partner, I earn from qualifying purchases.
If you find these projects useful please consider becoming a sponsor with Patreon, GitHub or Liberapay.

MainForm popsup again after closing

Post Reply
Pascal
Posts: 3
Joined: Sat Dec 21, 2019 5:53 pm

MainForm popsup again after closing

Post by Pascal »

Hi,

I've added TChromium to my application. Studied the examples and information on your website. Also adjusted my application dpr file as explained in the examples and on the website. It works very nice but the only issue I'm having is when my application is closed. After closing it pops up again and then after a few second it closes definitely.

Debugged it and it pops up again when it hits cef_shutdown. After this step continues (a few seconds) the application closes definitely. Quite annoying so I must be doing something wrong. Any idea?

Regards,
Pascal

Code: Select all

procedure TCefApplicationCore.ShutDown;
begin
  try
    if (FStatus = asInitialized) then
      begin
        FStatus := asShuttingDown;
        cef_shutdown();
      end;
  except
    on e : exception do
      if CustomExceptionHandler('TCefApplicationCore.ShutDown', e) then raise;
  end;
end;



Code: Select all

program Project1;

uses
  Vcl.Forms,
  WinApi.Windows,
  uCEFApplication,
  Unit1 in 'Unit1.pas' {Form1};

{$R *.res}

{$SetPEFlags IMAGE_FILE_LARGE_ADDRESS_AWARE}

begin
  GlobalCEFApp := TCefApplication.Create;

  if GlobalCEFApp.StartMainProcess then
    begin
      Application.Initialize;
      Application.MainFormOnTaskbar := True;
      Application.CreateForm(TForm1, Form1);
      Application.Run;
    end;

  GlobalCEFApp.Free;
end.
User avatar
salvadordf
Posts: 4571
Joined: Thu Feb 02, 2017 12:24 pm
Location: Spain
Contact:

Re: MainForm popsup again after closing

Post by salvadordf »

Hi,

The code included in your message is correct.

Please, provide a complete example or the modifications needed in one of the demos to replicate the issue.
Pascal
Posts: 3
Joined: Sat Dec 21, 2019 5:53 pm

Re: MainForm popsup again after closing

Post by Pascal »

Thanks for your reply. It was my fault. Hmm... I removed the 'if GlobalCEFApp.StartMainProcess then' part. Wanted to be sure that the application would always start but it created the issue I was having.

Made a donation, great project :!: Much appreciated.

Regards, Pascal

Code: Select all

program Project1;

uses
  Vcl.Forms,
  WinApi.Windows,
  uCEFApplication,
  Unit1 in 'Unit1.pas' {Form1};

{$R *.res}

{$SetPEFlags IMAGE_FILE_LARGE_ADDRESS_AWARE}

begin
  GlobalCEFApp := TCefApplication.Create;

  Application.Initialize;
  Application.MainFormOnTaskbar := True;
  Application.CreateForm(TForm1, Form1);
  Application.Run;

  GlobalCEFApp.Free;
end.
User avatar
salvadordf
Posts: 4571
Joined: Thu Feb 02, 2017 12:24 pm
Location: Spain
Contact:

Re: MainForm popsup again after closing

Post by salvadordf »

Thank you very much for the donation Pascal!!! :D

Even small open source projects like this one have some expenses and require time but your donation makes it much easier.

Thanks a lot!
Post Reply