Précédent   Forum des professionnels en informatique > Webmasters - Développement Web > Langages serveur > ASP
ASP Forum sur la programmation ASP. Avant de poster : Cours ASP, FAQ ASP
Partagez cette discussion sur d'autres réseaux sociaux : Viadeo Twitter Google Facebook Digg Delicious MySpace Yahoo
Réponse Proposer ce sujet en actualité
 
Outils de la discussion
Publicité
'
Vieux 27/07/2006, 12h02   #1
Membre habitué
 
Développeur informatique
Inscription : octobre 2003
Messages : 448
Détails du profil
Informations personnelles :
Âge : 30

Informations professionnelles :
Activité : Développeur informatique

Informations forums :
Inscription : octobre 2003
Messages : 448
Points : 134
Points : 134
Par défaut Affichier la liste des imprimante en VbScript

Je voudrais afficher la liste des imprimantes de la machines dans une liste déroulante :

mais j'ai une erreur sur mon code en ligne 16 : "strComputer = ".""

voici mon code :

Code :
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
 
 
<% @LANGUAGE="VBScript" %>
 
<html> 
 <head>
  <script language="VBscript">
   Function liste(form5)
    MsgBox "Elément " & (form5.list.selectedIndex + 1)
   End Function 
  </script> 
 </head> 
 <body> Entrez votre choix : 
  <form name="form5"> 
   <select name="list"> 
   <%
    strComputer = "."
    Set objWMIService = GetObject("winmgmts:" & "{impersonationLevel=impersonate}!\\" & strComputer & "\root\cimv2")
    Set colInstalledPrinters =  objWMIService.ExecQuery("Select * from Win32_PrinterConfiguration")
   %> 
   <% For Each objPrinter in colInstalledPrinters %>
    <option value="<% = objPrinter.Name %>"><% = objPrinter.Name %></option>
   <% Next %>
   </select>
   <input type="button" name="b" value="Quel est l'imprimante retenu ?" onClick="liste(form5)"> 
  </form>
 </body> 
</html>
PrinceMaster77 est déconnecté   Envoyer un message privé Réponse avec citation 00
Vieux 01/08/2006, 10h01   #2
Expert Confirmé Sénior

 
Avatar de Immobilis
 
Inscription : mars 2004
Messages : 5 849
Détails du profil
Informations forums :
Inscription : mars 2004
Messages : 5 849
Points : 5 965
Points : 5 965
Salut,

Pas mal! Chez moi ça marche.

A+
Immobilis est déconnecté   Envoyer un message privé Réponse avec citation 00
Réponse Proposer ce sujet en actualité
Outils de la discussion



Fuseau horaire GMT +2. Il est actuellement 12h09.


 
 
 
 
Partenaires

Hébergement Web