level 2
angere之泪
楼主
procedure TForm1.Edit2KeyPress(Sender: TObject; var Key: Char);
var
voice: OLEVariant;
begin
voice := CreateOLEObject('SAPI.SpVoice');
if key=#13 then
begin
if Edit2.Text=Edit1.Text then
begin
Label1.Caption:='PASS';
Label1.Font.Color:=clGreen;
voice.Speak('测试成功!',0);
end
else
begin
Label1.Caption:='FAIL';
Label1.Font.Color:=clRed;
voice.Speak('测试失败!', 0);
end;
form1.ActiveControl:=edit1
end;
end;
//为什么不同步,语音先出来了,但是LABEL文字比较延迟出来,有没有办法同时出现
2018年03月10日 02点03分
1
var
voice: OLEVariant;
begin
voice := CreateOLEObject('SAPI.SpVoice');
if key=#13 then
begin
if Edit2.Text=Edit1.Text then
begin
Label1.Caption:='PASS';
Label1.Font.Color:=clGreen;
voice.Speak('测试成功!',0);
end
else
begin
Label1.Caption:='FAIL';
Label1.Font.Color:=clRed;
voice.Speak('测试失败!', 0);
end;
form1.ActiveControl:=edit1
end;
end;
//为什么不同步,语音先出来了,但是LABEL文字比较延迟出来,有没有办法同时出现