掲示板システム
ホーム
アクセス解析
カテゴリ
ログアウト
自身を含む複数フォームの生成と破棄 (ID:22970)
名前
ホームページ(ブログ、Twitterなど)のURL (省略可)
本文
Notificationの中でForm2を再作成してはいけません。 (まだ後始末が残っているため) 参考) Form1に inteface ・・・ const WM_DELAYEDEVENT = WM_APP+1; type TForm1 = class(TForm) private ・・・ procedure WmDelayedEvent(var Msg:TMessage); message WM_DELAYEDEVENT; ・・・ protected procedure Notification(AComponent: TComponent; Operation: TOperation); override; private ・・・ end; ・・・ implementation ・・・ procedure TForm1.Notification(AComponent: TComponent; Operation: TOperation); begin inherited; if (Operation = opRemove) then begin if(AComponent is TForm2) then begin FForm2 := nil; PostMessage(Handle, WM_DELAYEDEVENT, 1, 0); end; end; end; procedure TForm1.WmDelayedEvent(var Msg: TMessage); begin case Msg.WParam of 1: if FReset then begin FForm2 := nil; FReset := False; FForm2 := TForm2.Create(Self); FForm2.Show; end else Application.Terminate; end; end; ・・・ の様に時間差攻撃を仕掛けてください。
←解決時は質問者本人がここをチェックしてください。
更新する
戻る
掲示板システム
Copyright 2021 Takeshi Okamoto All Rights Reserved.