🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

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

Re: how to detect if a printer a postscript printer in c++

#13391
From: Vladimir Afanasyev
Date: Wed, 15 Oct 2003 07:44
67 lines
3657 bytes
Hi,

"Richard Yu" <richard@colorselector.com> wrote:
>want to in a programming language detect if a printer is a postscript print
>, is it possible ? any library function can do that ?
>

It seems that I  sent it to you or it is not work?

         HANDLE hPrinter;
          PRINTDLG pd;
          DEVMODE *dv;
             int nEscapeCode;
             TCHAR szTechnology[MAX_PATH] = TEXT("");

ZeroMemory(&pd, sizeof(PRINTDLG));
pd.lStructSize = sizeof(PRINTDLG);
pd.hwndOwner = GetDesktopWindow();
pd.hDevMode = NULL; // Don't forget to free or store hDevMode.
pd.hDevNames = NULL; // Don't forget to free or store hDevNames.
pd.Flags = PD_RETURNDC ;
pd.nCopies = 4;
pd.nFromPage = 0xFFFF;
pd.nToPage = 0xFFFF;
pd.nMinPage = 1;
pd.nMaxPage = 0xFFFF;


if (PrintDlg(&pd)==TRUE) {

           dv=(LPDEVMODE)pd.hDevMode;
           char** Name=(char**)dv->dmDeviceName;
           ShowMessage(AnsiString((const char*)*Name));
           Edit1->Text=AnsiString((const char*)*Name);
             // If it supports POSTSCRIPT_PASSTHROUGH, it must be PS.
             nEscapeCode = POSTSCRIPT_PASSTHROUGH;
             if( ExtEscape( pd.hDC, QUERYESCSUPPORT, sizeof(int),
(LPCSTR)&nEscapeCode, 0, NULL ) > 0 )
                     {ShowMessage("Escape POSTSCRIPT_PASSTHROUGH is supported" );
                     return;}

             ShowMessage("Escape POSTSCRIPT_PASSTHROUGH is not supported" );
             // If it doesn't support GETTECHNOLOGY, we won't be able to tell.
             nEscapeCode = GETTECHNOLOGY;
             if( ExtEscape( pd.hDC, QUERYESCSUPPORT, sizeof(int),
(LPCSTR)&nEscapeCode, 0, NULL ) <= 0 )
                     {ShowMessage("Escape GETTECHNOLOGY is not supported" );
                     return;}
                      ShowMessage("Escape GETTECHNOLOGY is supported" );

             // Get the technology string and check to see if the word"postscript" is in it.
             if( ExtEscape( pd.hDC, GETTECHNOLOGY, 0, NULL, MAX_PATH,
(LPSTR)szTechnology ) <= 0 )
                     return;
             strupr( szTechnology );
             if( strstr( szTechnology, "POSTSCRIPT" ) == NULL )
                    {
                     ShowMessage("postscript is not supported" );
                     ShowMessage(AnsiString("Using technology is:")+szTechnology);
                     return;}

                     ShowMessage("postscript is supported" );
                     ShowMessage(AnsiString("Using technology is:")+szTechnology);
      }

Vladimir.
Technical Details
Message-ID: <3f8cfaf6$1@newsgroups.borland.com>
Path: arc1-ca.pugleaf.net!archiver1.google.com!news1.google.com!sn-xit-02!sn-xit-06!sn-xit-01!sn-xit-09!supernews.com!newshosting.com!news-xfer2.atl.newshosting.com!38.144.126.70.MISMATCH!feed3.newsreader.com!newsreader.com!border1.nntp.aus1.giganews.com!nntp.giganews.com!newsfeeds.ihug.co.nz!ihug.co.nz!newsgroups.borland.com!not-for-mail
References: <3f8c71fd$1@newsgroups.borland.com>

Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit
X-Google-Thread: 10cc67,3ac529bf9ac223f1
X-Google-Attributes: gid10cc67,public
X-Google-ArrivalTime: 2003-10-15 00:57:09 PST
From: "Vladimir Afanasyev" <avv@systema.kiev.ua>
Sender: "Vladimir Afanasyev" <avv@systema.kiev.ua>
Reply-To: "Vladimir Afanasyev" <avv@systema.kiev.ua>
Subject: Re: how to detect if a printer a postscript printer in c++
Newsgroups: borland.public.cppbuilder.nativeapi
X-User-Info: 212.82.216.226     
X-Forwarded-For: 192.168.0.147
References:  <3f8c71fd$1@newsgroups.borland.com>
NNTP-Posting-Host: 207.105.83.66
Message-ID: <3f8cfaf6$1@newsgroups.borland.com>
Date: 15 Oct 2003 00:44:54 -0700
X-Trace: newsgroups.borland.com 1066203894 207.105.83.66 (15 Oct 2003 00:44:54 -0700)
Lines: 67
Path: arc1-ca.pugleaf.net!archiver1.google.com!news1.google.com!sn-xit-02!sn-xit-06!sn-xit-01!sn-xit-09!supernews.com!newshosting.com!news-xfer2.atl.newshosting.com!38.144.126.70.MISMATCH!feed3.newsreader.com!newsreader.com!border1.nntp.aus1.giganews.com!nntp.giganews.com!newsfeeds.ihug.co.nz!ihug.co.nz!newsgroups.borland.com!not-for-mail