🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: borland.public.cppbuilder.nativeapi
Article #17028

Re: printer driver for "Text Only" printer

#17028
From: Gary Setter
Date: Thu, 10 Apr 2003 13:55
41 lines
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);
   }
}
Technical Details
Message-ID: <3e957801@newsgroups.borland.com>
Path: arc1-ca.pugleaf.net!archiver1.google.com!news1.google.com!sn-xit-02!sn-xit-04!sn-xit-03!sn-xit-06!sn-xit-08!supernews.com!newsfeed.wirehub.nl!news.kweb.on.ca!KWeb!newsgroups.borland.com!not-for-mail
References: <3e95497f@newsgroups.borland.com>

Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit
X-Google-Thread: 10cc67,f2214e094c069c58
X-Google-Attributes: gid10cc67,public
X-Google-ArrivalTime: 2003-04-10 07:03:07 PST
From: "Gary Setter" <setterg@worldnet.att.net>
Newsgroups: borland.public.cppbuilder.nativeapi
References: <3e95497f@newsgroups.borland.com>
Subject: Re: printer driver for "Text Only" printer
Date: Thu, 10 Apr 2003 08:55:36 -0500
Lines: 42
MIME-Version: 1.0
Content-Type: text/plain;
 charset="iso-8859-1"
Content-Transfer-Encoding: 7bit
X-Priority: 3
X-MSMail-Priority: Normal
X-Newsreader: Microsoft Outlook Express 6.00.2800.1106
X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1106
NNTP-Posting-Host: 12.84.32.165
Message-ID: <3e957801@newsgroups.borland.com>
X-Trace: newsgroups.borland.com 1049982977 12.84.32.165 (10 Apr 2003 06:56:17 -0700)
Path: arc1-ca.pugleaf.net!archiver1.google.com!news1.google.com!sn-xit-02!sn-xit-04!sn-xit-03!sn-xit-06!sn-xit-08!supernews.com!newsfeed.wirehub.nl!news.kweb.on.ca!KWeb!newsgroups.borland.com!not-for-mail