Date: 02-16-2022
Return to Index
'Compilable Example: (Jose Includes)
created by gbSnippets
#Compiler PBWin 10
#Compile Exe
#Dim All
%Unicode=1
#Include "Win32API.inc"
%IDC_Slow = 500
%IDC_Fast = 501
Global hDlg As Dword, vRes, vTxt As Variant, oSp As Dispatch
Function PBMain() As Long
Dialog Default Font "Tahoma", 12, 1
Dialog New Pixels, 0, "SAPI, Test Code",300,300,200,75, %WS_OverlappedWindow To hDlg
Control Add Button, hDlg, %IDC_Slow,"Slow", 10,10,75,25
Control Add Button, hDlg, %IDC_Fast,"Fast", 100,10,75,25
Dialog Show Modal hDlg Call DlgProc
End Function
CallBack Function DlgProc() As Long
Local vRate As Long
Select Case Cb.Msg
Case %WM_InitDialog
vTxt = "Hello from Gary Beene"
osp = NewCom "SAPI.SpVoice"
Case %WM_Command
Select Case Cb.Ctl
Case %IDC_Slow
vRate = -3
Object Let osp.Rate() = vRate
Object Call osp.Speak(vTxt) To vRes
Case %IDC_Fast
vRate = +3
Object Let osp.Rate() = vRate
Object Call osp.Speak(vTxt) To VRes
End Select
End Select
End Function
http://www.garybeene.com/sw/gbsnippets.htm