Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Add a printer with "Generic / Text Only" driver programmatically?

147 views
Skip to first unread message

John Hornick [MS]

unread,
Dec 5, 2002, 5:22:43 PM12/5/02
to
Hi,

> I'm trying to install a printer with the driver "Generic /
> Text only" on COM1 port on W2k. With "AddPrinterDriverEx"
> I load a DRIVER_INFO_4 structure, with previous copied
> files. After this I use "AddPrinter" for installing the
> printer. The printer doesn't work. When I reinstall the
> driver "Generic / Text Only" by the systems wizard it
> works properly.
> What is to do that I can install the generic driver
> programmatically?

Use GetPrinter() and GetPrinterDriver() on a pre-existing "good"
installation to determine what to specify in the AddPrinter()
and AddPrinterDriver() calls.

Thanks,
- John
Microsoft Developer Support
This posting is provided "AS IS" with no warranties, and confers no rights.
Visit http://www.microsoft.com/security for current information on security.

Adrian vonGunten

unread,
Dec 6, 2002, 3:36:59 AM12/6/02
to
>.
Hi John,
I've tried it. The problem is with the Printer driver and
not the AddPrinter function. I see the files unidrv.dll,
tty.gpd, unidrvui.dll, unidrv.hlp unires.dll with the
DRIVER_INFO_4 structure. I added the path I'd got with
GetPrinterDriverDirectory to this filenames and called
AddPrinterDriverEx. This call is successfully, I can see
the driver with GetPrinterDriver, The files are copied to
the version depending subdirectory (here it's 3),
everything looks fine. But when I start to use the printer
with the driver it doesn't work. A reinstall with the
wizard is needed and the printer works. When I look again
to the DRIVER_INFO 4 structure I can't see any changes.
I've noticed that the wizard adds additionally files like
tty.dll, tty.bud, tty.ini etc.
My questions are what is needed else to start a
generic /text only driver working to the serial port? Do
you have an example exactly for this driver? Or can I see
somewhere what is the "Add printer driver" wizard exactly
doing?

Adrian von Gunten

PENTAG Informatik AG
Wankdorffeldstrasse 102
3000 Bern 22
Switzerland

John Hornick [MS]

unread,
Dec 6, 2002, 9:56:20 AM12/6/02
to
Hi,

> I've tried it. The problem is with the Printer driver and
> not the AddPrinter function. I see the files unidrv.dll,
> tty.gpd, unidrvui.dll, unidrv.hlp unires.dll with the
> DRIVER_INFO_4 structure. I added the path I'd got with
> GetPrinterDriverDirectory to this filenames and called
> AddPrinterDriverEx. This call is successfully, I can see
> the driver with GetPrinterDriver, The files are copied to
> the version depending subdirectory (here it's 3),
> everything looks fine. But when I start to use the printer
> with the driver it doesn't work. A reinstall with the
> wizard is needed and the printer works. When I look again
> to the DRIVER_INFO 4 structure I can't see any changes.
> I've noticed that the wizard adds additionally files like
> tty.dll, tty.bud, tty.ini etc.
> My questions are what is needed else to start a
> generic /text only driver working to the serial port? Do
> you have an example exactly for this driver? Or can I see
> somewhere what is the "Add printer driver" wizard exactly
> doing?


It sounds like you're not handling the dependent files
properly. As noted in the docs, it is a double-NULL terminated
string. In other words, it can look like this:
"file1.dll\0file2.dll\0file3.dll\0\0"

You're probably just parsing the first filename and missing
the rest.

Read the docs to determine how to handle each member of the struct.

Adrian von Gunten

unread,
Dec 10, 2002, 7:23:22 AM12/10/02
to
>.
>
Hi John,
This was exactly the problem. Now it works. Thank you very
much, John

Adrian von Gunten
Pentag Informatik AG
3000 Bern 22

0 new messages