开上百个窗口?,好象free的时候并不把内存也frdd完哦,关闭后内存每次都会少一点,我也不知道
那出了问题。
//new
function tfrmhtmlbrowser.newpages(url: string): tEmbeddedWB;
var
tabsheet: ttabsheet;
webbrowser: tEmbeddedWB;
begin
tagcount := tagcount + 1;
tabsheet := ttabsheet.Create(Self);
tabsheet.Caption := url;
tabsheet.Tag := tagcount;
webbrowser := tEmbeddedWB.Create(Self);
webbrowser.Tag := tagcount;
webbrowser.ReplaceCaption := True;
tabsheet.PageControl := pagecontrol;
tabsheet.InsertControl(webbrowser);
webbrowser.Align := alclient;
webbrowser.OnStatusTextChange := webbrowserstatustextchange;
webbrowser.OnCommandStateChange := WebBrowserCommandStateChange;
webbrowser.OnDownloadComplete := webbrowserdownloadcomplete;
webbrowser.OnDocumentComplete :=webbrowserDocumentComplete;
webbrowser.OnBeforeNavigate2 := WebBrowserBeforeNavigate2;
webbrowser.OnDownloadBegin := WebBrowserDownloadBegin;
webbrowser.OnNewWindow2 := webbrowserNewWindow2;
webbrowser.OnTitleChange := webbrowserTitleChange;
if url <> '' then webbrowser.Go(url);
if checkbox_ShowNew.Checked then pagecontrol.ActivePage := tabsheet;
Result := webbrowser;
end;
//free
procedure Tfrmhtmlbrowser.CloseBtnClick(Sender: TObject);
var
i: integer;
begin
for i := 0 to pagecontrol.ActivePage.ControlCount - 1 do
pagecontrol.ActivePage.Controls.Free;
pagecontrol.ActivePage.Free;
if pagecontrol.PageCount = 0 then newpages('about:blank');
end;