调用 speeker.dll 这个文件被本人 放在文件里面,若有人需要可以 联系我
需要 mfc100ud.dll msvcr100d.dll
注:可以用D7 自带的ActiveX 里面的控件,可以调速,需要安装语音包。
unit Unit1; interface uses
Winapi.Windows, Winapi.Messages, System.SysUtils, System.Variants, System.Classes, Vcl.Graphics,
Vcl.Controls, Vcl.Forms, Vcl.Dialogs, Vcl.StdCtrls; type
TForm1 = class(TForm)
Button1: TButton;
Memo1: TMemo;
ComboBox1: TComboBox;
procedure FormDestroy(Sender: TObject);
procedure FormShow(Sender: TObject);
procedure ComboBox1Change(Sender: TObject);
procedure Button1Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end; var
Form1: TForm1;
c: pwidechar;
m:widechar; implementation {$R *.dfm}
function D3DPERF_EndEvent:DWORD;stdcall;external'speeker.dll';
procedure CreatTTS(h:hwnd);stdcall;external'speeker.dll';
procedure Speak(var words:widechar);stdcall;external'speeker.dll';
procedure FreeMe();stdcall;external'speeker.dll';
function GetTokens_num:integer;stdcall;external'speeker.dll';
procedure SetToken_i(i:integer);stdcall;external'speeker.dll';
function GetToken_i(i:integer):PAnsichar;stdcall;external'speeker.dll';
procedure MySpeak(s:string);
begin
stringtowidechar(s,@m, length(s)*);
Speak(m);
end; procedure TForm1.Button1Click(Sender: TObject);
begin
MySpeak(memo1.Lines.Text);
end; procedure TForm1.ComboBox1Change(Sender: TObject);
begin
SetToken_i(ComboBox1.ItemIndex);
end; procedure TForm1.FormDestroy(Sender: TObject);
begin
freeme;
end; procedure TForm1.FormShow(Sender: TObject);
var
i:integer;
begin
CreatTTS(form1.Handle);
for i := to (GetTokens_num-) do
ComboBox1.AddItem(GetToken_i(i),nil);
end; end.
object Form1: TForm1
Left =
Top =
Caption = 'Form1'
ClientHeight =
ClientWidth =
Color = clBtnFace
Font.Charset = DEFAULT_CHARSET
Font.Color = clWindowText
Font.Height = -
Font.Name = 'Tahoma'
Font.Style = []
OldCreateOrder = False
OnDestroy = FormDestroy
OnShow = FormShow
PixelsPerInch =
TextHeight =
object Button1: TButton
Left =
Top =
Width =
Height =
Caption = #
TabOrder =
OnClick = Button1Click
end
object Memo1: TMemo
Left =
Top =
Width =
Height =
ImeName = ##'('##') - '#######
Lines.Strings = (
#####)
TabOrder =
end
object ComboBox1: TComboBox
Left =
Top =
Width =
Height =
ImeName = ##'('##') - '#######
TabOrder =
OnChange = ComboBox1Change
end
end