Communauté
AutoCAD – tous produits - Français
Bienvenue sur les forums AutoCAD d’Autodesk. Partagez vos connaissances, posez des questions, et explorez les sujets AutoCAD populaires.
annuler
Affichage des résultats de 
Afficher  uniquement  | Rechercher plutôt 
Vouliez-vous dire : 

Lancer un programme en tache de fond

4 RÉPONSES 4
Répondre
Message 1 sur 5
Anonymous
918 Visites, 4 Réponses

Lancer un programme en tache de fond

Bonsoir,
C'est NOEL donc j'ai dessiné un arbre de noel en 3D (un truc simple) avec
des petites boules, en VBA je lance une macro et tout clignote. :::)))))
En tache de fond, ds le code je veux lancer une musique de noel:'
RetVal = Shell("C:\ProgramFiles\VideoLAN\VLC\vlc.exe noel.wav", 6)
RetVal = Shell("noel.bat", 0) (noel.bat lance vle.exe avec son argument)
Le problème c'est que cela me bloque le code en attente du retour du
shell().
Bien sur je peux lancer mon .bat avec l'explorateur Windows et revenir sur
ma fenetre Autocad et lancer la macro, ca marche.
Je crois qu'il existe une API Windows qui permet de gérer une tache de fond?
J'ai questionné google.....
Avez vous une idée.
Merci d'avance
4 RÉPONSES 4
Message 2 sur 5
Anonymous
en réponse à: Anonymous

'essaye ceci peut etre.........................................


'This project needs :

'- a common dialog box, named CDbox

' (To add the Common Dialog Box to your tools menu, go to
Project->Components (or press CTRL-T)

' and select Microsoft Common Dialog control)

'-a button

Private 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

Const SND_ASYNC = &H1

Const SND_NODEFAULT = &H2

Private Sub Command1_Click()

'KPD-Team 1998

'URL: http://www.allapi.net/

'E-Mail: KPDTeam@Allapi.net

'Get the number of installed waveout devices

ret& = waveOutGetNumDevs

If ret& > 0 Then

'Set the CommonDialogBox' filter

CDBox.Filter = "Wave-files (*.wav)|*.wav|All Files (*.*)|*.*"

'Set the CommonDialogBox' title

CDBox.DialogTitle = "Choose your wave-file ..."

'Show the 'Open File'-dialog

CDBox.ShowOpen

'Play the selected sound

sndPlaySound CDBox.filename, SND_ASYNC Or SND_NODEFAULT

Else

MsgBox "No soundcard detected !"

End If

End Sub

Private Sub Form_Load()

Command1.Caption = "Load WAV"

End Sub
Message 3 sur 5
Anonymous
en réponse à: Anonymous

Un peu dans le meme principe
Private Const SND_ASYNC = &H1 'Joue le son en arrière-plan.
Private Const SND_FILENAME = &H20000 'Le son provient d'un fichier externe
Private Const SND_LOOP = &H8 ' Répète le son jusqu'au prochain appel de
PlaySound

Private Declare Function PlaySound Lib "winmm.dll" Alias "PlaySoundA" (ByVal
lpszName As String, ByVal hModule As Long, ByVal dwFlags As Long) As Long

Private Sub Command1_Click()

if Dir("C:\ProgramFiles\VideoLAN\VLC\noel.wav") <> "" Then
PlaySound "C:\ProgramFiles\VideoLAN\VLC\noel.wav", ByVal 0&,
SND_FILENAME Or SND_ASYNC
End If

marc

"sigecom" a écrit dans le message de news:
5800033@discussion.autodesk.com...
'essaye ceci peut etre.........................................


'This project needs :

'- a common dialog box, named CDbox

' (To add the Common Dialog Box to your tools menu, go to
Project->Components (or press CTRL-T)

' and select Microsoft Common Dialog control)

'-a button

Private 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

Const SND_ASYNC = &H1

Const SND_NODEFAULT = &H2

Private Sub Command1_Click()

'KPD-Team 1998

'URL: http://www.allapi.net/

'E-Mail: KPDTeam@Allapi.net

'Get the number of installed waveout devices

ret& = waveOutGetNumDevs

If ret& > 0 Then

'Set the CommonDialogBox' filter

CDBox.Filter = "Wave-files (*.wav)|*.wav|All Files (*.*)|*.*"

'Set the CommonDialogBox' title

CDBox.DialogTitle = "Choose your wave-file ..."

'Show the 'Open File'-dialog

CDBox.ShowOpen

'Play the selected sound

sndPlaySound CDBox.filename, SND_ASYNC Or SND_NODEFAULT

Else

MsgBox "No soundcard detected !"

End If

End Sub

Private Sub Form_Load()

Command1.Caption = "Load WAV"

End Sub
Message 4 sur 5
Anonymous
en réponse à: Anonymous

Salut !

Super le sapin !
Comment fait-on pour faire clignoter les boules ?
Sans doute une macro à lancer ?
Merci
Patrice
"Bruno" a écrit dans le message de news:
5799784@discussion.autodesk.com...
Bonsoir,
C'est NOEL donc j'ai dessiné un arbre de noel en 3D (un truc simple) avec
des petites boules, en VBA je lance une macro et tout clignote. :::)))))
En tache de fond, ds le code je veux lancer une musique de noel:'
RetVal = Shell("C:\ProgramFiles\VideoLAN\VLC\vlc.exe noel.wav", 6)
RetVal = Shell("noel.bat", 0) (noel.bat lance vle.exe avec son argument)
Le problème c'est que cela me bloque le code en attente du retour du
shell().
Bien sur je peux lancer mon .bat ave
c l'explorateur Windows et revenir sur
ma fenetre Autocad et lancer la macro, ca marche.
Je crois qu'il existe une API Windows qui permet de gérer une tache de fond?
J'ai questionné google.....
Avez vous une idée.
Merci d'avance
Message 5 sur 5
Anonymous
en réponse à: Anonymous

Bonsoir,
Merci à sigecom et à marc sylvain, les 2 méthodes fonctionnent en
asynchrone.
J'ai glissé la macro en macro d'ouverture du document, donc lancement
automatique, voir le .zip.
J'ai essayé d'améliorer l'ensemble, en fixant une image en fond (avec la
commande rendu), mais compte tenu des .update ce n'est pas concluant.
Je vais essayer de faire tomber la neige ou faire passer une père noel
:::))))
Pour patrick come, c'est une macro qui parcourt les # objets et suivant le
type applique une rotation (texte) ou change la couleur.

"sigecom" a écrit dans le message de news:
5800033@discussion.autodesk.com...
'essaye ceci peut etre.........................................


'This project needs :

'- a common dialog box, named CDbox

' (To add the Common Dialog Box to your tools menu, go to
Project->Components (or press CTRL-T)

' and select Microsoft Common Dialog control)

'-a button

Private 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

Const SND_ASYNC = &H1

Const SND_NODEFAULT = &H2

Private Sub Command1_Click()

'KPD-Team 1998

'URL: http://www.allapi.net/

'E-Mail: KPDTeam@Allapi.net

'Get the number of installed waveout devices

ret& = waveOutGetNumDevs

If ret& > 0 Then

'Set the CommonDialogBox' filter

CDBox.Filter = "Wave-files (*.wav)|*.wav|All Files (*.*)|*.*"

'Set the CommonDialogBox' title

CDBox.DialogTitle = "Choose your wave-file ..."

'Show the 'Open File'-dialog

CDBox.ShowOpen

'Play the selected sound

sndPlaySound CDBox.filename, SND_ASYNC Or SND_NODEFAULT

Else

MsgBox "No soundcard detected !"

End If

End Sub

Private Sub Form_Load()

Command1.Caption = "Load WAV"

End Sub

Vous n'avez pas trouvé ce que vous recherchiez ? Posez une question à la communauté ou partagez vos connaissances.

Publier dans les forums  

Autodesk Design & Make Report