OLE Control window handle error with WebBrowser and Delphi 2007

前端 未结 1 732
栀梦
栀梦 2021-01-26 13:01

I have run into an issue a couple of weeks ago that appear to have no logical explanation. I\'m building an application with Delphi 2007 using AlphaControls and a WebBrowser com

1条回答
  •  生来不讨喜
    2021-01-26 13:48

    It is caused by the html form being closed. The vendor's forums show some code that will fix the problem. http://www.bsalsa.com/forum/showthread.php?t=255

    Set Cancel to True in the OnWindowClosing event and navigate to an empty page if it is the main webbrowser. In case your webbrowser is a popup window, you may want to close the form the EWB is on.

    procedure TForm2.EmbeddedWB1WindowClosing(ASender: TObject; IsChildWindow: WordBool; var Cancel: WordBool);
    begin
      Cancel := True;
      (ASender as TEmbeddedWB).GoAboutBlank;
    end;
    

    0 讨论(0)
提交回复
热议问题