Date: 02-16-2022
Return to Index
created by gbSnippets
'Compilable Example: (Jose Includes)
#Compile Exe
#Dim All
%Unicode=1
#Include "Win32API.inc"
#Include "Sapi.inc"
%IDC_Fast = 501
%IDC_Slow = 502
Global hDlg As Dword, psp As ISpVoice, wText As WString
Function PBMain() As Long
Dialog Default Font "Tahoma", 12, 1
Dialog New Pixels, 0, "SAPI Test Code",300,300,300,75, %WS_OverlappedWindow To hDlg
Control Add Button, hDlg, %IDC_Slow,"Slow", 10,10,75,20
Control Add Button, hDlg, %IDC_Fast,"Fast", 100,10,75,20
Dialog Show Modal hDlg Call DlgProc
End Function
CallBack Function DlgProc() As Long
Select Case Cb.Msg
Case %WM_InitDialog
wText = "Hello from Gary Beene"
pSp = NewCom "SAPI.SpVoice"
Case %WM_Command
Select Case Cb.Ctl
Case %IDC_Slow
psp.SetRate -3
pSp.Speak(ByVal StrPtr(wText), %SPF_Async, ByVal %Null)
Case %IDC_Fast
psp.SetRate +3
pSp.Speak(ByVal StrPtr(wText), %SPF_Async, ByVal %Null)
End Select
End Select
End Function
http://www.garybeene.com/sw/gbsnippets.htm