[摘要]Make WebUtils DLL来创建DLL。这个组件将保存在同你保存源代码相同路径下。在命令行中通过以下命令注册DLL。RegSvr32 c:\Utils\WebUtils.dll 在页面中使用...
Make WebUtils DLL来创建DLL。这个组件将保存在同你保存源代码相同路径下。
在命令行中通过以下命令注册DLL。
RegSvr32 c:\Utils\WebUtils.dll
在页面中使用组件
下面显示的ASP代码将列出与你系统相连的所有打印机。通过改写这些代码,你可以添加一个下拉列表框,使得用户在其中选择一个打印机,然后将他们的选择传递给你自己的定制组件,将报告输出到所选的打印机上。
Printers.asp
--------------------------------------------------------------------------------
<% Option Explicit %>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN"><HTML><HEAD> <TITLE>System Printers</TITLE></HEAD>
<BODY BGCOLOR="#FFFFFF"><FONT SIZE="2" FACE="Verdana, Arial, Helvetica">
<CENTER><H1>Web Server Printers</H1></CENTER><HR Color="Red">
<%
Dim oSystemPrinters
Dim i
Set oSystemPrinters = Server.CreateObject("WebUtils.WebPrinters")
%>
There are <%=oSystemPrinters.PrinterCount%> Server printers<BR>
<%
i = oSystemPrinters.PrinterCount
If i > 0 Then
For i = 0 to i - 1
%>
Printer <% =cstr(i + 1) %>: <%=oSystemPrinters.deviceName(cint(i))%><BR>
<%
Next
End If
Set oSystemPrinters = Nothing ' De-reference the object
%>
</BODY>
</HTML>
关键词:列出服务器上的打印机