掲示板システム
ホーム
アクセス解析
カテゴリ
ログアウト
TStreamAdapterのメモリーリークの防止は (ID:34828)
名前
ホームページ(ブログ、Twitterなど)のURL (省略可)
本文
みなさんまたまた教えて頂きたいことが置きました。 TWebBrowserの表示中の画面のソースを取得したいので 次のようなサンプルを見つけてそのまま使っていますが チェッカーをかけると 推定クラス名:TStreamAdapter)でメモリーリーリークしているとでるのです。 いろいろやっているのですが、対処法を教えて頂けませんか。 function TForm1.GetSource: String; var Doc: IHTMLDocument2; Persist: IPersistStream; Mem: TStringStream; begin if (Form1.PageControl1.ActivePage as TTabSheetEx).EmbeddedWB1.Document = nil then Exit; Mem := TStringStream.Create(''); try Doc := (Form1.PageControl1.ActivePage as TTabSheetEx).EmbeddedWB1.Document as IHTMLDocument2; if Doc = nil then Exit; Persist := Doc as IPersistStreamInit; Persist.Save(TStreamAdapter.Create(Mem), True); Result := Mem.DataString; finally Mem.Free; end; end;
←解決時は質問者本人がここをチェックしてください。
更新する
戻る
掲示板システム
Copyright 2021 Takeshi Okamoto All Rights Reserved.