I want to install printer through programatically
For this i have used AddPrinterDriver function.
This function is giving lots of problems.I am working on Win2K
I have used DRIVER_INFO_3 structure.
I am facing problem in passing the parameters to this structure.
i am adding the piece of this code
obj.cVersion = 3 ;
obj.pEnvironment = “Windows NT x86” ;
obj.pName = “SAMSUNG SRP270 Partial Cut” ;
obj.pDataFile =
“c:\winnt\system32\spool\drivers\w32x86\SRP270PC.Gpd” ;
obj.pDriverPath = dir ;
obj.pConfigFile =
“c:\winnt\system32\spool\drivers\w32x86\UNIDRV.dll” ;
obj.pDefaultDataType = “RAW” ;
obj.pDependentFiles =
“RASDD.dll\0RASDDUI.dll\0SRP270.dll\0STDNAMES.Gpd\0SRP270PC.Gpd\0\0” ;
obj.pHelpFile = “UNIDRV.HLP” ;
obj.pMonitorName = NULL ;
BOOL ret = AddPrinterDriver(NULL, // server name
3, // driver information level
(LPBYTE)&obj // driver information buffer
);
This is giving file not found.(Error 2)
I am getting the driver path from the GetPrinterDriverDirectory function.
Sometimes it gives error no 5 , 216.
Also one more question is:
Is this function alone will add the printer icon in the printers or do i
have to use any more functions. if so, please let me know.
Can anybody help me out of this problem
You have the DriverPath and ConfigFile set incorrectly. The pDriverPath
member has a very misleading name. From the SDK docs: pDriverPath is a
Pointer to a null-terminated string that specifies a file name or full
path and file name for the file that contains the device driver (for
example, “C:\DRIVERS\Pscript.dll”). ConfigFile should be pointing to
unidrvui.dll and not unidrv.dll as indicated in your code snippet.
pDriverPath should point to unidrv.dll.
You need to call AddPrinter after AddPrinterDriver to add a printer
programmatically.
This posting is provided “AS IS” with no warranties, and confers no
rights.
-----Original Message-----
From: uma [mailto:xxxxx@rediffmail.com]
Sent: Friday, April 12, 2002 1:46 AM
To: NT Developers Interest List
Subject: [ntdev] AddPrinterDriver Function
I want to install printer through programatically
For this i have used AddPrinterDriver function.
This function is giving lots of problems.I am working on Win2K I have
used DRIVER_INFO_3 structure. I am facing problem in passing the
parameters to this structure.
i am adding the piece of this code
obj.cVersion = 3 ;
obj.pEnvironment = “Windows NT x86” ;
obj.pName = “SAMSUNG SRP270 Partial Cut” ;
obj.pDataFile =
“c:\winnt\system32\spool\drivers\w32x86\SRP270PC.Gpd” ;
obj.pDriverPath = dir ; obj.pConfigFile =
“c:\winnt\system32\spool\drivers\w32x86\UNIDRV.dll” ;
obj.pDefaultDataType = “RAW” ; obj.pDependentFiles =
“RASDD.dll\0RASDDUI.dll\0SRP270.dll\0STDNAMES.Gpd\0SRP270PC.Gpd\0\0” ;
obj.pHelpFile = “UNIDRV.HLP” ; obj.pMonitorName = NULL ;
BOOL ret = AddPrinterDriver(NULL, // server name
3, // driver information level
(LPBYTE)&obj // driver information buffer
);
This is giving file not found.(Error 2)
I am getting the driver path from the GetPrinterDriverDirectory
function. Sometimes it gives error no 5 , 216. Also one more question
is: Is this function alone will add the printer icon in the printers or
do i have to use any more functions. if so, please let me know.
Can anybody help me out of this problem
You are currently subscribed to ntdev as: xxxxx@microsoft.com To
unsubscribe send a blank email to %%email.unsub%%