Bonjour Bruno,
OK j'ai testé sur Win 2000 Pro, en effet le code que Vériland avait déniché ne passe pas... Du coup j'ai remonté toutes les base de connaissance de MS !
Et donc j'ai trouvé, il faut remplacer le Flag = EWX_SHUTDOWN par EWX_POWEROFF....
Je n'ai pas testé sous la Procédure de Véri, mais sur une Macro de MS çà fonctionne sous WIN 2000 Pro !
Lien pour trouver la procédure complète :
<http://support.microsoft.com/default.aspx?scid=http://support.microsoft.com:80/support/kb/articles/Q168/7/96.ASP&NoWebContent=1>
NB bien qu'il y ait écrit "This article demonstrates how to programmatically restart or log off a computer in Visual Basic. The sample code shown in this article creates a project that can normally or forcibly perform these functions on a computer with a Windows 95, Windows 98, Windows Me, Windows 2000, or Windows NT operating system." IL FAUT FAIRE LE REMPLACEMENT POUR WIN 2000 comme j'ai indiqué plus haut si on veut rééllement ETEINDRE sous WIN 2000 (pas besoin sous XP)
Voilà, je pense que tu pourras partir en week end comme çà Bruno !!!
Bon Week End à Tous et Toutes
@+Thierry