Page 1 of 1

Re: Close browser without WM_Close

Posted: Tue Apr 17, 2018 7:27 pm
by salvadordf
Yes, you can replace the WM_CLOSE for a custom message or any other method you like as long as you don't close your application before closing all the browsers correctly.

To close a browser you must follow this sequence if you use TChromium and TCEFWindowParent in normal mode (non OSR mode):
  • Call TChromium.CloseBrowser(True) which triggers the TChromium.OnClose event.
  • In the TChromium.OnClose event you must send a custom message to your app to destroy TCEFWindowParent in the main thread, which triggers the TChromium.OnBeforeClose event.
  • In the TChromium.OnBeforeClose event you must send a different custom message to your app to notify that the browser is correctly closed.
This sequence is used in many demos right before closing the main form but you can close the browsers previously without using WM_CLOSE.