🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

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

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

#13328
From: Richard Yu
Date: Wed, 15 Oct 2003 22:15
83 lines
4104 bytes
thanks for the code,

My system is  win2k, it's said win2k need the function PrintDlgEx,
I have tried assigning the Ex version params, no success, did you try the
win 2k Ex version ? have some Ex testing code ?

"Vladimir Afanasyev" <avv@systema.kiev.ua> wrote in message
news:3f8cfaf6$1@newsgroups.borland.com...
>
> 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: <3f8ed6a6$1@newsgroups.borland.com>
Path: arc1-ca.pugleaf.net!archiver1.google.com!news1.google.com!sn-xit-02!sn-xit-03!sn-xit-01!sn-xit-09!supernews.com!newshosting.com!news-xfer1.atl.newshosting.com!news-spur1.maxwell.syr.edu!news.maxwell.syr.edu!newsfeed00.sul.t-online.de!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mail
References: <3f8c71fd$1@newsgroups.borland.com> <3f8cfaf6$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-16 10:40:46 PST
From: "Richard Yu" <richard@colorselector.com>
Newsgroups: borland.public.cppbuilder.nativeapi
References:  <3f8c71fd$1@newsgroups.borland.com> <3f8cfaf6$1@newsgroups.borland.com>
Subject: Re: how to detect if a printer a postscript printer in c++
Date: Wed, 15 Oct 2003 15:15:18 -0700
Lines: 85
X-Priority: 3
X-MSMail-Priority: Normal
X-Newsreader: Microsoft Outlook Express 5.50.4522.1200
X-MimeOLE: Produced By Microsoft MimeOLE V5.50.4522.1200
NNTP-Posting-Host: 24.207.7.224
Message-ID: <3f8ed6a6$1@newsgroups.borland.com>
X-Trace: newsgroups.borland.com 1066325670 24.207.7.224 (16 Oct 2003 10:34:30 -0700)
Path: arc1-ca.pugleaf.net!archiver1.google.com!news1.google.com!sn-xit-02!sn-xit-03!sn-xit-01!sn-xit-09!supernews.com!newshosting.com!news-xfer1.atl.newshosting.com!news-spur1.maxwell.syr.edu!news.maxwell.syr.edu!newsfeed00.sul.t-online.de!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mail