掲示板システム
ホーム
アクセス解析
カテゴリ
ログアウト
Timerで呼び出したウィンドウのEinvalidoperationをなくす方法は? (ID:42238)
名前
ホームページ(ブログ、Twitterなど)のURL (省略可)
本文
Form1(IndexMain)です。 procedure TIndexMain.Button1Click(Sender: TObject); begin Making:=TPMaking.Create(Application); Making.ShowModal; Making.update; end; procedure TIndexMain.Button2Click(Sender: TObject); begin close; end; procedure TIndexMain.onActivate(Sender: TObject); begin Edit1.text:=''; timer1.interval:=1000; TimeStep:=0; TradeOn:=0; Timer1.Enabled := false; end; procedure TIndexMain.OnKeyPress(Sender: TObject; var Key: Char); var s:string; begin if key=char(13) then begin s:=Edit1.text; if S='TO' then begin Timep:=0; TradeOn:=1; TimeStep:=0; Edit1.text:='自動'; Timer1.Enabled:=true; end; if S='TOF' then begin TradeOn:=0; TimeStep:=0; Edit1.text:=''; end; end end; procedure TIndexMain.ontimer(Sender: TObject); var Str1:Pchar; p:integer; begin timer1.interval:=20000; p:=timesu; if p<timeP+1 then exit; TimeStep:=0; if (TradeOn=1) and (TimeStep=0) then begin Timer1.Enabled := False; TimeStep:=1; if (TimeStep=1) then begin TimeStep:=2; Making:=TPMaking.Create(Application); Making.ShowModal; Making.update; end; Timer1.Enabled := True; end; timep:=timesu; end; function TIndexMain.Timesu:integer; Var s:string; p:integer; begin s:=TimeToStr(time); p:=InStr(1,s,':'); Timesu:=StrToInt(copy(s,1,p-1)+copy(s,P+1,2)); end; function TIndexMain.InStr(StartPos:integer;const Str, SubStr:string):integer ; var pStr,p:PChar; begin pStr := PChar(Str); p := AnsiStrPos(PChar(pStr+StartPos-1),PChar(SubStr)); if p = nil then result := 0 else result := p-pStr+1; end; Form2(Dmaking)です。 procedure TPMaking.OnActivate(Sender: TObject); var n:integer; begin Dmaking; PostMessage(Handle,WM_CLOSE,0,0); end; procedure TPMaking.Dmaking; var n:integer; begin for n :=1 to 10 do begin edit1.Text:='Hellow'; application.processMessages; sleep(1000); edit1.Text:=''; application.processMessages; sleep(1000); end; end; procedure TPMaking.Button2Click(Sender: TObject); begin close; end; 何か、あまり長いものは載せたらいけないのではと思いますが、 ネット関連のエラーが防げるようになれば、許されるかなと思いまして。 ごめんです。
←解決時は質問者本人がここをチェックしてください。
戻る
掲示板システム
Copyright 2021 Takeshi Okamoto All Rights Reserved.