'Ce VBS permet d'afficher un message (Msgbox avec 1, 2 ou 3 boutons) pendant un
'certain temps (en secondes) et contrôle la réponse.
'Le paramétrage est entièrement décrit en commentaire.
'********************************************************
Set WshShell = WScript.CreateObject("WScript.Shell")
Aff "choix ?",3
Sub Aff(s, duree)
intButton = WshShell.Popup(s,duree ,"Question :", 3 + 48 + 256)
'WScript.Echo "Réponse "& intButton
Select Case intButton
case 2 WScript.Echo "Réponse :Annuler"
case 6 WScript.Echo "Réponse :Oui"
case 7 WScript.Echo "Réponse :Non"
case -1 WScript.Echo "Aucune réponse ?"
End Select
End Sub
'WshShell.Popup (paramètres)
'intButton = object.Popup(strText,[nSecondsToWait],[strTitle],[nType])
'nSecondsToWait = nbr de sec et = 0 si attente réponse buttons
'nTypes (Bouttons)
'Decimal value Hexa value Description
'0 0x0 Show OK button.
'1 0x1 Show OK and Cancel buttons.
'2 0x2 Show Abort, Retry, and Ignore buttons.
'3 0x3 Show Yes, No, and Cancel buttons.
'4 0x4 Show Yes and No buttons.
'5 0x5 Show Retry and Cancel buttons.
'6 0x6 Show Cancel, Try Again, and Continue buttons.
'nType (Icon)
'16 0x10 Show "Stop Mark" icon.
'32 0x20 Show "Question Mark" icon.
'48 0x30 Show "Exclamation Mark" icon.
'64 0x40 Show "Information Mark" icon.
'Other Type Values
'256 0x100 The second button is the default button.
'512 0x200 The third button is the default button.
'4096 0x1000 The message box is a system modal message box and appears in a topmost window.
'524288 0x80000 The text is right-justified.
'1048576 0x100000 The message and caption text display in right-to-left reading order, which is useful for some languages.
'intButton values
'-1 Aucun
'1 OK
'2 Cancel
'3 Abort
'4 Retry
'5 Ignore
'6 Yes
'7 No
'10 Try Again
'11 Continue
Vous n'êtes pas encore membre ?
inscrivez-vous, c'est gratuit et ça prend moins d'une minute !
Les membres obtiennent plus de réponses que les utilisateurs anonymes.
Le fait d'être membre vous permet d'avoir un suivi détaillé de vos demandes et codes sources.
Le fait d'être membre vous permet d'avoir des options supplémentaires.