Cenzic 232 Patent
Paid Advertising
sla.ckers.org is
ha.ckers sla.cking
Sla.ckers.org
This group should mostly be dealing with how web applications enable networking security issues that are otherwise not there. Everything is being tunneled over port 80 now so what does that enable and how do we fix it? 
Go to Topic: PreviousNext
Go to: Forum ListMessage ListNew TopicSearchLog In
Printing on network
Posted by: kane_666
Date: December 23, 2006 02:03AM

This is mostly programming related but since its printing to network printers, i figured I'll place it here ;)

Basically I'm writing a program in Visual Basic (because the computers are windows based, and I'm no that good at c/c++) that will print user defined text to a printer a specified amount of times.

The program I've written works, but what i need is a function that will install all network printers. Like the windows 'Add Printer' function.

So I'll try and give you an example.
I'm running a network with 5 printers attached but on my computer i only have 1 installed. What i need is to "at the press of a button" install the remaining 4 printers then i can print my document on each printer.

Basically I'm being lazy and i don't want to have to install 1 printer at a time... i want to incorporate a feature in my program to get a list of all printers, then install them.

Any help would be great! Thanks.

Options: ReplyQuote
Re: Printing on network
Posted by: BrianWGray
Date: August 27, 2007 04:48PM

Never done it in strait vb you could probably take some examples from vbs login scripts though. The VB objects shouldn't be too different.

something like

' Name: printers.vbs
' Description: Add a network printer and make it the default

Set WshNetwork = CreateObject("WScript.Network")

' Adds the printer. Substitute your server name and printer share.

' first example captures a network printer using lpt2
WshNetwork.AddwindowsPrinterConnection "LPT2",""\\Server\printer1"

' second example is without capturing lpt2
WshNetwork.AddwindowsPrinterConnection "\\Server\printer2", "printer name here"

' the following line makes the specified printer the default.
WshNetwork.SetDefaultPrinter "\\Server\printer1"

- QnJpYW5XR3JheUBnbWFpbC5jb20=



Edited 1 time(s). Last edit at 08/27/2007 04:49PM by BrianWGray.

Options: ReplyQuote


Sorry, only registered users may post in this forum.