OVH Cloud OVH Cloud

Appeler collections de sons Windows

4 réponses
Avatar
Florian
BOnjour
J'essaie depuis fort longtemps...
D'appeler des sons wma, de Windows.
Comment faire ?
Merci beaucoup

4 réponses

Avatar
LeSteph
Bonjour,
Ils ont été supprimés dans Excel
je ne sais plus depuis Excel5 je crois,
mais il y a un truc sur Excelabo pour avoir des sons.
Des intégrations midi.
Sinon il faudrait peut-être chercher dans les API ..?.dll

LeSteph



"Florian" a écrit dans le message de
news:
BOnjour
J'essaie depuis fort longtemps...
D'appeler des sons wma, de Windows.
Comment faire ?
Merci beaucoup




Avatar
Florian
Ok merci Lesteph, je crois cependant que l'on peut appeler des sons Windows
?
Flo riant

"LeSteph" a écrit dans le message de
news:40fa8798$0$29378$
Bonjour,
Ils ont été supprimés dans Excel
je ne sais plus depuis Excel5 je crois,
mais il y a un truc sur Excelabo pour avoir des sons.
Des intégrations midi.
Sinon il faudrait peut-être chercher dans les API ..?.dll

LeSteph



"Florian" a écrit dans le message de
news:
BOnjour
J'essaie depuis fort longtemps...
D'appeler des sons wma, de Windows.
Comment faire ?
Merci beaucoup








Avatar
Daniel.j
Bonsoir
En utilisant cette macro de Aurélien NORIE ( MS) (et de Laurent Daures ?)
et en faisant "croire" à excel qu'il s'agit de mp3
On peut aussi inserer un objet
==========================
Public Declare Function mciSendString Lib "winmm.dll" Alias "mciSendStringA" _
(ByVal lpstrCommand As String, ByVal lpstrReturnString As String, _
ByValuReturnLength As Long, ByVal hwndCallback As Long) As Long _

Public Declare Function GetShortPathName Lib "kernel32" Alias _
"GetShortPathNameA" (ByVal lpszLongPath As String, ByVal lpszShortPath As _
String, ByVal cchBuffer As Long) As Long


Sub LanceMP3()
X = ThisWorkbook.Path
joueMP3 (X & "lambada.wma")
End Sub


Public Sub joueMP3(ByVal Mp3 As String)
Dim Tmp As Long, Tmp2 As String
Tmp2 = NomCourt(Mp3)
Tmp = mciSendString("close MP3_Device", vbNullString, 0&, 0&)
Tmp = mciSendString("open " & Tmp2 & " type MPEGVideo alias MP3_Device", _
vbNullString, 0&, 0&)
If Tmp = 0 Then
Tmp = mciSendString("play Mp3_Device", vbNullString, 0&, 0&)
If Tmp <> 0 Then
Screen.MousePointer = 0
MsgBox "Incapable de jouer ce Mp3"
End If
Else
MsgBox "Incapable de jouer ce Mp3"
End If
End Sub
Public Sub StopMP3()
Dim Tmp As Long
Tmp = mciSendString("close MP3_Device", vbNullString, 0&, 0&)
End Sub

Private Function NomCourt(ByVal Fichier As String) As String
Dim Tmp As String * 255, Tmp2 As Byte
Tmp2 = GetShortPathName(Fichier, Tmp, Len(Tmp))

If Tmp2 > 0 Then
NomCourt = Left(Tmp, Tmp2)
End If
End Function

Daniel
FAQ du Forum Microsoft Public Fr Excel
http://dj.joss.free.fr/faq.htm

"Florian" a écrit dans le message de news:

| BOnjour
| J'essaie depuis fort longtemps...
| D'appeler des sons wma, de Windows.
| Comment faire ?
| Merci beaucoup
|
|
Avatar
Florian
Merci beaucoup Daniel, c'est très sympa de ta part.
Bonne soirée
Flo riant

"Daniel.j" a écrit dans le message de
news:
Bonsoir
En utilisant cette macro de Aurélien NORIE ( MS) (et de Laurent Daures ?)
et en faisant "croire" à excel qu'il s'agit de mp3
On peut aussi inserer un objet
========================== >
Public Declare Function mciSendString Lib "winmm.dll" Alias
"mciSendStringA" _

(ByVal lpstrCommand As String, ByVal lpstrReturnString As String, _
ByValuReturnLength As Long, ByVal hwndCallback As Long) As Long _

Public Declare Function GetShortPathName Lib "kernel32" Alias _
"GetShortPathNameA" (ByVal lpszLongPath As String, ByVal lpszShortPath As
_

String, ByVal cchBuffer As Long) As Long


Sub LanceMP3()
X = ThisWorkbook.Path
joueMP3 (X & "lambada.wma")
End Sub


Public Sub joueMP3(ByVal Mp3 As String)
Dim Tmp As Long, Tmp2 As String
Tmp2 = NomCourt(Mp3)
Tmp = mciSendString("close MP3_Device", vbNullString, 0&, 0&)
Tmp = mciSendString("open " & Tmp2 & " type MPEGVideo alias
MP3_Device", _

vbNullString, 0&, 0&)
If Tmp = 0 Then
Tmp = mciSendString("play Mp3_Device", vbNullString, 0&, 0&)
If Tmp <> 0 Then
Screen.MousePointer = 0
MsgBox "Incapable de jouer ce Mp3"
End If
Else
MsgBox "Incapable de jouer ce Mp3"
End If
End Sub
Public Sub StopMP3()
Dim Tmp As Long
Tmp = mciSendString("close MP3_Device", vbNullString, 0&, 0&)
End Sub

Private Function NomCourt(ByVal Fichier As String) As String
Dim Tmp As String * 255, Tmp2 As Byte
Tmp2 = GetShortPathName(Fichier, Tmp, Len(Tmp))

If Tmp2 > 0 Then
NomCourt = Left(Tmp, Tmp2)
End If
End Function

Daniel
FAQ du Forum Microsoft Public Fr Excel
http://dj.joss.free.fr/faq.htm

"Florian" a écrit dans le message de news:

| BOnjour
| J'essaie depuis fort longtemps...
| D'appeler des sons wma, de Windows.
| Comment faire ?
| Merci beaucoup
|
|