局域网内打印机的端口属性 RRS feed


  • 你好,

    你可以试一下下面的代码, 通过QueuePort属性获取端口信息,不知道是不是你需要的.


               // Create a PrintServer

                // "theServer" must be a print server to which the user has full print access.

                PrintServer myPrintServer = new PrintServer();


                // List the print server's queues

                PrintQueueCollection myPrintQueues = myPrintServer.GetPrintQueues();

                String printQueueNames = "My Print Queues:\n\n";

                foreach (PrintQueue pq in myPrintQueues)


                    printQueueNames += "\t" + pq.Name + "\n";

                    Console.WriteLine("queue driver:" + pq.QueueDriver.Name);

                    Console.WriteLine("queue port:" + pq.QueuePort.Name);


    MSDN Subscriber Support in Forum
    If you have any feedback of our support, please contact
    Please remember to mark the replies as answers if they help and unmark them if they provide no help.
    Welcome to the All-In-One Code Framework! If you have any feedback, please tell us.
    • 已标记为答案 eryang 2010年12月9日 5:26
    2010年11月28日 2:30