1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65
| Declare Function sndPlaySound Lib "winmm.dll" Alias "sndPlaySoundA" (ByVal lpszSoundName As String, ByVal uFlags As Long) As Long
Private Declare Function waveOutGetNumDevs Lib "winmm.dll" () As Long
Private Declare Function GetOpenFileName Lib "comdlg32.dll" Alias "GetOpenFileNameA" (pOpenfilename As OPENFILENAME) As Long
Private Const SND_SYNC As Long = &H0 ' Lecture complète du son avant disponibilité
Private Const SND_ASYNC As Long = &H1 ' Joue le son et et reste disponible
Private Const SND_NODEFAULT As Long = &H2 ' pas de BIP en cas d'erreur
Private Declare Function GetSystemDirectory Lib "kernel32" Alias "GetSystemDirectoryA" (ByVal lpBuffer As String, ByVal nSize As Long) As Long
Private Function DossierSystemWindows(ByVal AvecAntiSlash As Boolean)
'''' ------------------------------------------------------------------------
'''' - Permet d'obtenir le dossier System32 de Windows
'''' - Paramètres : AvecAntiSlash définit si l'on veut un séparateur
'''' ------------------------------------------------------------------------
Dim strDossier As String
Dim lngRetour As Long
strDossier = Space(255)
lngRetour = GetSystemDirectory(strDossier, 255)
strDossier = Left$(strDossier, lngRetour)
DossierSystemWindows = strDossier & IIf(AvecAntiSlash, "\", vbNullString)
End Function
Public Sub EnregistrerUnMotVocal()
'''' ------------------------------------------------------------------------
'''' - Permet de lancer une mono instance du magnétophone de Windows
'''' - Paramètres : aucun
'''' ------------------------------------------------------------------------
Const TITRE_PROGRAM As String = "Son - Magnétophone"
Const NOM_DE_CLASSE As String = "SoundRecorder"
Const MAGNETOPHONE As String = "SoundRecorder.exe"
Dim strNomFichier As String
Dim dblRetour As Double
If MettreAuPremierPlan(TITRE_PROGRAM, NOM_DE_CLASSE) Then
Else
strNomFichier = DossierSystemWindows(True) & MAGNETOPHONE
LancerUnProgramme strNomFichier
End If
End Sub
Public Function FichierExiste(ByVal NomDuFichier As String) As Boolean
'''' ------------------------------------------------------------------------
'''' - Vérifie l'existance d'un fichier définit par NomDuFichier
'''' - Paramètres : NomDuFichier = Nom du Fichier
'''' ------------------------------------------------------------------------
Dim oFSO As FileSystemObject
Set oFSO = New Scripting.FileSystemObject
FichierExiste = (oFSO.FileExists(NomDuFichier))
End Function
Public Sub LancerUnProgramme(ByVal NomDuProgramme As String)
'''' ------------------------------------------------------------------------
'''' - Lance l'instance d'un programme définit par NomDuFichier
'''' - Paramètres : NomDuProgramme = Nom du programme exécutable
'''' ------------------------------------------------------------------------
Dim lngAppPID As Long
Dim lngWindowHandle As Long
lngAppPID = Shell(NomDuProgramme, SW_SHOWNORMAL)
End Sub |
Partager