1
General / Re:¿Que toman?
« en: Enero 26, 2012, 07:32:05 pm »
como dice leandro, unos mates, o quizas una cerveza dpendiendo je..
Esta sección te permite ver todos los posts escritos por este usuario. Ten en cuenta que sólo puedes ver los posts escritos en zonas a las que tienes acceso en este momento.
<System.Runtime.InteropServices.DllImport("winmm.dll")> _
Private Shared Function mciSendString(ByVal lpstrCommand As String, _
ByVal lpstrReturnString As StringBuilder, ByVal uReturnLength As Integer, ByVal hwndCallBack As Integer) As Integer
End Function
Public Sub GoogleSpeak(ByVal text As String, Optional ByVal lenguaje As String = "es", Optional ByVal bdoevents As Boolean = True)
Dim temp As String = Environment.CurrentDirectory & "\temp.mp3"
Dim uri As String = "http://translate.google.com/translate_tts?tl=" & lenguaje & "&q=" & text
Try
My.Computer.Network.DownloadFile(Uri, temp)
If mciSendString("open " & temp & " type MpegVideo" & " alias myfile", Nothing, 0, 0) = 0 Then
Dim buff As New StringBuilder(256)
Call mciSendString("status myfile length ", buff, 256, 0)
Dim lenght As Long = CType(Long.Parse(buff.ToString()) / 1000, Long)
If lenght Then
If mciSendString("play myFile", Nothing, 0, 0) = 0 Then
Do While mciSendString("status myfile position ", buff, 256, 0) = 0
If CType(Long.Parse(buff.ToString()) / 1000, Long) = lenght Then Exit Do
If bdoevents Then Application.DoEvents()
Loop
End If
End If
Call mciSendString("close myfile", Nothing, 0, 0)
System.IO.File.Delete(temp)
End If
Catch ex As System.IO.IOException
If System.IO.File.Exists(temp) Then
System.IO.File.Delete(temp)
End If
End Try
End Sub