var Form1: TForm1; spvoice1:TSpVoice; implementation
{$R *.dfm} procedure readTxt(str:string); //id标识语言,由config配置 var FileName:string; istokens:ISpeechObjectTokens; istoken:ISpeechObjectToken; f:TextFile; begin {init spvoice} CoInitialize(nil); spvoice1:=TSpVoice.Create(nil); istokens:=spvoice1.GetVoices('',''); spvoice1.Voice:=istokens.Item(0); spvoice1.Speak(str,SVSFDefault); spvoice1.Free; end; function GetName(TextToCheck:String;expre:string):string;//利用正则表达式过滤出链接 Var myExpr: TRegExpr; str:string ; temp_result:string; // list_str:TStringList; begin //list_str:=TStringList.Create; myExpr := TRegExpr.Create; //Form1.ComboBox1.Clear; Try myExpr.Expression :=expre; if myExpr.Exec(TextToCheck) then repeat begin temp_result:=temp_result+myExpr.Match[1]+#13#10; end; until not MyExpr.ExecNext; finally myExpr.Free; end;
//list_str.SaveToFile('./channel.ini'); Result:=temp_result; end; procedure TForm1.Button1Click(Sender: TObject); var s:string; begin if Edit1.Text='' then begin MessageBox(0,'丫头,是不是还没输入年?','提示',48); Exit; end; Memo1.Clear; statusbar1.SimpleText:='开始搜索网络资源,请稍候!长时间无响应,请检查您的网络!'; s:='http://www.dreye.com.cn:8080/dict/dict_gb.jsp?w='+edit1.Text; s:=Trim(s); Memo2.Text:=IdHTTP1.Get(s); Memo1.Lines.Add('单词:'+GetName(Memo2.Text,'