Bonsoir,
>>As-tu bien déclaré le nombre de module dans les options du programme. Lorsque que tu fais circuler des engins sur les zones nouvellement rétrosignalisées, vois-tu les repères sur le TCO changé de couleur??
Au moment du test, une et une seule carte était déclarée et connectée. Je dois avoir un pb de câblage
que je dois encore réparer. Les repères n'ont donc pas été modifiés.
>>Et???... tu peux expliquer son fonctionnement...
J'ai écrit un petit bout de code en VB6
:
La forme engin comporte 2 boutons CmdSon(0) et CmdSon(1)
de style graphical et de backcolor=&H000000FF&
Dans un module declaration.bas
'DLL et const pour Lecture des fichier son
Declare Function PlaySound Lib "WINMM.DLL" Alias "PlaySoundA" (ByVal lpszName As String, ByVal hModule As Long, ByVal dwFlags As Long) As Long
Public Const SND_SYNC = &H0 ' play synchronously (default)
Public Const SND_TYPE_MASK = &H170007
Public Const SND_VALID = &H1F ' valid flags / ;Internal /
Public Const SND_VALIDFLAGS = &H17201F ' Set of valid flag bits. Anything outside
Public Const SND_ALIAS = &H10000 ' name is a WIN.INI [sounds] entry
Public Const SND_ALIAS_ID = &H110000 ' name is a WIN.INI [sounds] entry identifier
Public Const SND_ALIAS_START = 0 ' must be > 4096 to keep strings in same section of resource file
Public Const SND_APPLICATION = &H80 ' look for application specific association
Public Const SND_ASYNC = &H1 ' play asynchronously
Public Const SND_FILENAME = &H20000 ' name is a file name
Public Const SND_LOOP = &H8 ' loop the sound until next sndPlaySound
Public Const SND_MEMORY = &H4 ' lpszSoundName points to a memory file
Public Const SND_NODEFAULT = &H2 ' silence not default, if sound not found
Public Const SND_NOSTOP = &H10 ' don't stop any currently playing sound
Public Const SND_NOWAIT = &H2000 ' don't wait if the driver is busy
Public Const SND_PURGE = &H40 ' purge non-static events for task
Dans la forme Engin
Option Explicit
Dim gstrEngineSound(10) As String
Private Sub CmdSon_Click(Index As Integer)
Dim lret As Long
If CmdSon(Index).BackColor = vbRed Then
CmdSon(Index).BackColor = vbGreen
lret = PlaySound(gstrEngineSound(Index), 0, SND_FILENAME + SND_ASYNC)
CmdSon(Index).BackColor = vbRed
End If
End Sub
Private Sub Form_Load()
gstrEngineSound(0) = "C:\DCC\LTD2\trainsiffle1.wav"
gstrEngineSound(1) = "C:\DCC\LTD2\trainsiffle2.wav"
CmdSon(0).BackColor = vbRed
CmdSon(1).BackColor = vbRed
End Sub
En espérant que cela puisse être utilisable.
Cordialement,
Xavier