写个群注的程序,一个form页负责验证码的输入,
if suiCheckBox1.Checked then
begin
Sinaform();
end;
if suiCheckBox2.Checked then
begin
wyform();
end;
这样写第一个验证码还没输入就进行到第二个了,怎样等待sinaform完成后再进行wyform,procedure sinaform();
var
code: string;
imagestream: TMemoryStream;
png: TPNGObject;
begin
sinahttp:= Tidhttp.create;
sinahttp.Request.UserAgent:= 'Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US) AppleWebKit/532.8 (KHTML, like Gecko) Chrome/4.0.288.1 Safari/532.8';
sinahttp.Request.Accept:= 'application/xml,application/xhtml+xml,text/html;q=0.9,text/plain;q=0.8,image/png,*/*;q=0.5';
sinahttp.Request.AcceptLanguage:= 'zh-CN,zh;q=0.8';
sinahttp.Request.Referer:= 'http://login.sina.com.cn/signup/signup.php';
imagestream:= TMemoryStream.Create;
png := TPngObject.Create;
Randomize;
code:= Inttostr(Random(99999999));
try
sinahttp.Get('http://login.sina.com.cn/cgi/pin.php?r='+ code,imagestream);
Sleep(500);
try
imagestream.Position:=0 ;
png.LoadFromStream(imagestream);
form2.Image1.picture.assign(png);
finally
png.Free;
imagestream.Free;
end;
form2.Show;
finally
end;
end;
if suiCheckBox1.Checked then
begin
Sinaform();
end;
if suiCheckBox2.Checked then
begin
wyform();
end;
这样写第一个验证码还没输入就进行到第二个了,怎样等待sinaform完成后再进行wyform,procedure sinaform();
var
code: string;
imagestream: TMemoryStream;
png: TPNGObject;
begin
sinahttp:= Tidhttp.create;
sinahttp.Request.UserAgent:= 'Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US) AppleWebKit/532.8 (KHTML, like Gecko) Chrome/4.0.288.1 Safari/532.8';
sinahttp.Request.Accept:= 'application/xml,application/xhtml+xml,text/html;q=0.9,text/plain;q=0.8,image/png,*/*;q=0.5';
sinahttp.Request.AcceptLanguage:= 'zh-CN,zh;q=0.8';
sinahttp.Request.Referer:= 'http://login.sina.com.cn/signup/signup.php';
imagestream:= TMemoryStream.Create;
png := TPngObject.Create;
Randomize;
code:= Inttostr(Random(99999999));
try
sinahttp.Get('http://login.sina.com.cn/cgi/pin.php?r='+ code,imagestream);
Sleep(500);
try
imagestream.Position:=0 ;
png.LoadFromStream(imagestream);
form2.Image1.picture.assign(png);
finally
png.Free;
imagestream.Free;
end;
form2.Show;
finally
end;
end;
can't make a visible window modalvisible := false也不行,
Form2.visible:=false;
Form2.showmodal;