Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Installing a printer driver programmatically
Message
General information
Forum:
Visual FoxPro
Category:
Installation, Setup and Configuration
Environment versions
Visual FoxPro:
VFP 9
OS:
Windows Server 2003
Network:
Windows 2003 Server
Database:
Visual FoxPro
Miscellaneous
Thread ID:
00984245
Message ID:
00984277
Views:
14
Rick,

I believe you can use WMI to do this. Check in the System32 folder for a file called prndrvr.vbs for a full implementation of it (or you can even call the script from your program) here is a VFP very stripped down version of it, i tested it replacing the lines that takes the parameters with the hard-coded commented out ones and it worked for me.
LPARAMETERS tcModel, tcEnvironment, tnVersion, tcFilePath, tcInfFile
LOCAL loWMI, loDriverInfo

loWMI			= GetObject("winmgmts:")
loDriverInfo		= loWMI.Get("Win32_PrinterDriver")

WITH loDriverInfo
	.Name              = tcModel
	.SupportedPlatform = tcEnvironment
	.Version           = tnVersion
	.FilePath          = tcFilePath
	.InfName           = tcInfFile

*	.Name			= "Apple LaserWriter 8500"
*	.SupportedPlatform	= "Windows NT x86"
*	.Version		= "3"
ENDWITH

RETURN loDriverInfo.AddPrinterDriver(loDriverInfo)
>Does anybody know how to install a printer driver programmatically?
>
>I have an application that needs to auto-install and includes some PDF printing features that run through the a PostScript driver, so I want to install the PostScript driver automatically.
>
>Is there any way to do this? The printer driver would be one of the included Windows printer drivers so it should always be there without requireing a disk for installation.
>
>+++ Rick ---
"The five senses obstruct or deform the apprehension of reality."
Jorge L. Borges?

"Premature optimization is the root of all evil in programming."
Donald Knuth, repeating C. A. R. Hoare

"To die for a religion is easier than to live it absolutely"
Jorge L. Borges
Previous
Reply
Map
View

Click here to load this message in the networking platform