Thread View: borland.public.cppbuilder.nativeapi
7 messages
7 total messages
Started by Christian
Thu, 10 Apr 2003 10:37
printer driver for "Text Only" printer
Author: Christian
Date: Thu, 10 Apr 2003 10:37
Date: Thu, 10 Apr 2003 10:37
6 lines
1225 bytes
1225 bytes
Hello, when I use AddPrinter() to install the "Generic - Text Only" printer, I get the error, that the printer driver is unknown. Can anybody tell me the name of the correct printer driver for the PRINTER_INFO_2 structure? Thanks Christian
Re: printer driver for "Text Only" printer
Author: Gary Setter
Date: Thu, 10 Apr 2003 13:55
Date: Thu, 10 Apr 2003 13:55
41 lines
2158 bytes
2158 bytes
"Christian" <scholle3783@icqmail.com> wrote in message
news:3e95497f@newsgroups.borland.com...
> Hello, when I use AddPrinter() to install the "Generic - Text Only"
printer,
> I get the error, that the printer driver is unknown. Can anybody tell me
the
> name of the correct printer driver for the PRINTER_INFO_2 structure?
>
> Thanks
> Christian
>
If you just want the default printer, might this help?
static const char * GetDriverName(DEVNAMES *DevNames)
{
return DevNames ? (char far*)DevNames + DevNames->wDriverOffset : 0;
}
/*
Get the device name from a DEVNAMES object.
*/
static const char * GetDeviceName(DEVNAMES *DevNames)
{
return DevNames ? (char far*)DevNames + DevNames->wDeviceOffset : 0;
}
DisplayDefaultPrinter(HWND hWnd)
{
PRINTDLG info;
memset(&info,0,sizeof(info));
info.lStructSize = sizeof(info);
info.hwndOwner = hWnd;
info.Flags = PD_RETURNDEFAULT;
PrintDlg(&info);
if (info.hDevNames) {
DEVNAMES * names = (DEVNAMES *)GlobalLock(info.hDevNames);
if (names)
MessageBox(hWnd,GetDriverName(names),GetDeviceName(names),MB_OK);
}
}
Re: printer driver for "Text Only" printer
Author: Christian
Date: Mon, 14 Apr 2003 13:49
Date: Mon, 14 Apr 2003 13:49
50 lines
2465 bytes
2465 bytes
Thanks Gary, but this is not what I need. I have to install the "Generic -
Text Only" printer, because of a component I use in my app. If no printer is
present the component goes mad ;-)
Christian
"Gary Setter" <setterg@worldnet.att.net> schrieb im Newsbeitrag
news:3e957801@newsgroups.borland.com...
>
> "Christian" <scholle3783@icqmail.com> wrote in message
> news:3e95497f@newsgroups.borland.com...
> > Hello, when I use AddPrinter() to install the "Generic - Text Only"
> printer,
> > I get the error, that the printer driver is unknown. Can anybody tell me
> the
> > name of the correct printer driver for the PRINTER_INFO_2 structure?
> >
> > Thanks
> > Christian
> >
>
> If you just want the default printer, might this help?
>
> static const char * GetDriverName(DEVNAMES *DevNames)
> {
> return DevNames ? (char far*)DevNames + DevNames->wDriverOffset : 0;
> }
> /*
> Get the device name from a DEVNAMES object.
> */
> static const char * GetDeviceName(DEVNAMES *DevNames)
> {
> return DevNames ? (char far*)DevNames + DevNames->wDeviceOffset : 0;
> }
>
> DisplayDefaultPrinter(HWND hWnd)
> {
> PRINTDLG info;
> memset(&info,0,sizeof(info));
> info.lStructSize = sizeof(info);
> info.hwndOwner = hWnd;
> info.Flags = PD_RETURNDEFAULT;
> PrintDlg(&info);
> if (info.hDevNames) {
> DEVNAMES * names = (DEVNAMES *)GlobalLock(info.hDevNames);
> if (names)
> MessageBox(hWnd,GetDriverName(names),GetDeviceName(names),MB_OK);
> }
> }
>
Re: printer driver for "Text Only" printer
Author: Gary Setter
Date: Tue, 15 Apr 2003 13:43
Date: Tue, 15 Apr 2003 13:43
18 lines
1695 bytes
1695 bytes
"Christian" <scholle3783@icqmail.com> wrote in message news:3e9abc7c@newsgroups.borland.com... > Thanks Gary, but this is not what I need. I have to install the "Generic - > Text Only" printer, because of a component I use in my app. If no printer is > present the component goes mad ;-) > > Christian <snip> Woops, that wasn't a helpful was it :-\ Did you try install the generic text printer on your machine, and then use EnumPrinters level 2 to get the PRINTER_INFO_2 values? Then you could uninstall the generic and AddPrinter with the above values. Just and idea. Contritely, Gary
Re: printer driver for "Text Only" printer
Author: Christian
Date: Wed, 16 Apr 2003 00:18
Date: Wed, 16 Apr 2003 00:18
18 lines
1504 bytes
1504 bytes
Could have been my idea *slapping forehead* I'll try it :) Christian "Gary Setter" <setterg@worldnet.att.net> schrieb im Newsbeitrag news:3e9c0cb1$1@newsgroups.borland.com... > > Woops, that wasn't a helpful was it :-\ > > Did you try install the generic text printer on your machine, and then use > EnumPrinters level 2 to get the PRINTER_INFO_2 values? Then you could > uninstall the generic and AddPrinter with the above values. Just and idea. > > Contritely, > Gary >
Re: printer driver for "Text Only" printer
Author: Claudiu Balciza
Date: Wed, 16 Apr 2003 11:00
Date: Wed, 16 Apr 2003 11:00
29 lines
1953 bytes
1953 bytes
please share your progress Claudiu "Christian" <scholle3783@icqmail.com> wrote in message news:3e9ca14b$1@newsgroups.borland.com... > Could have been my idea *slapping forehead* I'll try it :) > > Christian > > > "Gary Setter" <setterg@worldnet.att.net> schrieb im Newsbeitrag > news:3e9c0cb1$1@newsgroups.borland.com... > > > > Woops, that wasn't a helpful was it :-\ > > > > Did you try install the generic text printer on your machine, and then > use > > EnumPrinters level 2 to get the PRINTER_INFO_2 values? Then you could > > uninstall the generic and AddPrinter with the above values. Just and idea. > > > > Contritely, > > Gary > > > > > >
Re: printer driver for "Text Only" printer
Author: Christian
Date: Thu, 17 Apr 2003 09:36
Date: Thu, 17 Apr 2003 09:36
35 lines
2537 bytes
2537 bytes
Hi, I have used EnumPrinters() to get the values for the "Generic - Text Only" printer, then used them to create my own PRINTER_INFO_2 structure and it WORKS!! :-) The PRINTER_INFO_2 structure must be this: PrinterInfo->pServerName = NULL; PrinterInfo->pPrinterName = "Generic"; PrinterInfo->pShareName = NULL; PrinterInfo->pPortName = "FILE:"; PrinterInfo->pDriverName = "Generic / Text Only"; PrinterInfo->pComment = NULL; PrinterInfo->pLocation = NULL; PrinterInfo->pDevMode = NULL; PrinterInfo->pSepFile = NULL; PrinterInfo->pPrintProcessor = "WinPrint"; PrinterInfo->pDatatype = "RAW"; PrinterInfo->pParameters = NULL; PrinterInfo->pSecurityDescriptor = NULL; PrinterInfo->Attributes = 576; PrinterInfo->Priority = 1; PrinterInfo->DefaultPriority = 0; PrinterInfo->StartTime = 0; PrinterInfo->UntilTime = 0; PrinterInfo->Status = 0; PrinterInfo->cJobs = 0; PrinterInfo->AveragePPM = 0; Give this structure to AddPrinter() and you get a fileprinter called "Generic" that is not the default printer and is not shared. Thanks again Gary for your simple but great idea :-) Christian
Thread Navigation
This is a paginated view of messages in the thread with full content displayed inline.
Messages are displayed in chronological order, with the original post highlighted in green.
Use pagination controls to navigate through all messages in large threads.
Back to All Threads