|
-
May 5th, 1999, 07:30 AM
#1
How to install a printer?????
How can i install a printer into Windows?
Installing the driver is going Ok (AddPrinterDriver()), but then the printer is not shown in "Start, Settings, Printers"
The following code is used:
PRINTER_INFO_2 prinfo;
LPBYTE pprinfo;
prinfo.pServerName = NULL;
prinfo.pPrinterName = "Printer test";
prinfo.pShareName = NULL;
prinfo.pPortName = "LPT1";
prinfo.pDriverName = "Printer_test";//or use a known installed driver
prinfo.pComment = NULL;
prinfo.pLocation = NULL;
prinfo.pDevMode = NULL;
prinfo.pSepFile = NULL;
prinfo.pPrintProcessor = "winprint";
prinfo.pDatatype = "RAW";
prinfo.pParameters = NULL;
prinfo.pSecurityDescriptor = NULL;
prinfo.Attributes = NULL;
prinfo.Priority = NULL;
prinfo.DefaultPriority = NULL;
prinfo.StartTime = NULL;
prinfo.UntilTime = NULL;
pprinfo = (LPBYTE) &prinfo;
if(AddPrinter( NULL, 2, pprinfo )==NULL)
{
LPVOID lpMsgBuf;
FormatMessage(
FORMAT_MESSAGE_ALLOCATE_BUFFER |
FORMAT_MESSAGE_FROM_SYSTEM |
FORMAT_MESSAGE_IGNORE_INSERTS,
NULL,
GetLastError(),
MAKELANGID(LANG_NEUTRAL,
SUBLANG_DEFAULT),
(LPTSTR) &lpMsgBuf,
0,
NULL
);
MessageBox( NULL, (LPCTSTR)lpMsgBuf, "Error adding printer", MB_OK | MB_ICONERROR );
// Free the buffer.
LocalFree( lpMsgBuf );
return false;
}
This code gives "The printername is invallid"
anybody know what i'm doing wrong?
kind regards,
Mark
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|