Page 3 of 3

Re: Closing application correctly

Posted: Mon Aug 31, 2020 8:50 pm
by andreykrasnodar
Also there was problems with

Code: Select all

Form1.Hide
when I call it after

Code: Select all

Chromium1.CloseBrowser(true);
When I started to use

Code: Select all

Form1.Hide
1st, some problems disappear.

Re: Closing application correctly

Posted: Mon Aug 31, 2020 9:38 pm
by salvadordf
Please, use the code I sent you. I tested it and it works correctly.

As I comented before, "Application.ProcessMessages" is not recomended.

In fact, you will find many web pages that suggest the same thing for other kind of Delphi components. Application.ProcessMessages can only be used if you're really sure it won't cause problems with other components and this is one of the cases where its use is discouraged.

Additionally, some VCL functions were not designed with Chromium in mind. Sometimes they recreate handles when you don't expect it and this can also cause problems.

Re: Closing application correctly

Posted: Fri Sep 04, 2020 7:06 am
by andreykrasnodar
I have removed 2nd TChromium component and now program still not able to close. When I press X button, it hides main form and closes Chromium process, next I see
Access violation at address 006AEACA in module 'browser.exe'. Read of address 00000000.
OK
After pressing OK, program terminates. So everything is ok except this message.

Code: Select all

I removed this message making simple timer with code
procedure TForm1.Timer3Timer(Sender: TObject);
begin
  close;
end;
but... this it not a solution...

Re: Closing application correctly

Posted: Fri Sep 04, 2020 7:26 am
by andreykrasnodar
Sub-process terminates correctly
Application hides main form
After hiding the form, application is in processes for about 12-13 seconds
After 13 seconds it shows error message with OK button
After pressing OK it terminates.

Re: Closing application correctly

Posted: Fri Sep 04, 2020 8:33 am
by Student
Я сомневаюсь в правильности построения функций по работе с хромиумом, может поэтому и ошибки сыпит, что не может прочитать адрес несуществующего объекта. Ты писал ранее у тебя 1000 функций, вот убедись, что перед завершением работы хромиума эти функции не пытаются обращаться к хромиуму никоим образом, когда ты нажимаешь кнопку закрыть, все функции должны прервать свою работу, затем ты посылаешь сигнал завершения хромиума и потом закрывается программа.