Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
IsPrinterDotMatric()
Message
De
14/06/2005 13:38:51
 
 
À
14/06/2005 12:19:20
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Versions des environnements
Visual FoxPro:
VFP 6 SP5
OS:
Windows XP SP2
Network:
Windows NT
Database:
Visual FoxPro
Divers
Thread ID:
01019594
Message ID:
01023212
Vues:
70
>Sure, sounds like a good idea, maybe we could 'refine' the logic. see, all this code is doing, is to see if the printer is capable of printing more then 16 colors AND if the printer is capable of printing True Type Fonts as graphic (that doesn't neccesarly mean that it will print them as a graphic!).
>
>so, in my opinion this is not a SURE method of detecting a dot-matrix printer (not sure if there is any), but it will 'help' in providing the user with info, and, since i don't think its a fail-safe function, i've provided the user in my GUI with a way to overwrite this computer choice.
>
>when you look at the help for the 2 API's (GetDeviceCaps() and DeviceCapabilities()), you'll see that there are more printer infos one can find out. maybe an additional or replacment data would be more beneficial - more precise for a decission?! - i don't know.
>


Hi Gunnar,

Here are some additional data that might help for your decision. Look for GetDeviceCaps() at MSDN, you can get more data using it.
#Define _TAB    chr(9)
#Define _ENTER  chr(13) + chr(10)

*** Device Capabilities
#Define TECHNOLOGY   2
#Define CURVECAPS   28
#Define TEXTCAPS    34

** Tecnology
#Define DT_PLOTTER      0
#Define DT_RASDISPLAY   1
#Define DT_RASPRINTER   2
#Define DT_RASCAMERA    3
#Define DT_CHARSTREAM   4
#Define DT_METAFILE     5
#Define DT_DISPFILE     6

** Curve Capabilities
#Define CC_NONE           0
#Define CC_CIRCLES        1
#Define CC_PIE            2
#Define CC_CHORD          4
#Define CC_ELLIPSES       8
#Define CC_WIDE          16
#Define CC_STYLED        32
#Define CC_WIDESTYLED    64
#Define CC_INTERIORS    128
#Define CC_ROUNDRECT    256

** Text Capabilities
#Define TC_NONE          0x00000000
#Define TC_OP_CHARACTER  0x00000001
#Define TC_OP_STROKE     0x00000002
#Define TC_CP_STROKE     0x00000004
#Define TC_CR_90         0x00000008
#Define TC_CR_ANY        0x00000010
#Define TC_SF_X_YINDEP   0x00000020
#Define TC_SA_DOUBLE     0x00000040
#Define TC_SA_INTEGER    0x00000080
#Define TC_SA_CONTIN     0x00000100
#Define TC_EA_DOUBLE     0x00000200
#Define TC_IA_ABLE       0x00000400
#Define TC_UA_ABLE       0x00000800
#Define TC_SO_ABLE       0x00001000
#Define TC_RA_ABLE       0x00002000
#Define TC_VA_ABLE       0x00004000
#Define TC_RESERVED      0x00008000
#Define TC_SCROLLBLT     0x00010000


Local lc_PrinterName, lh_DC, ln_Caps

Declare Long CreateDC in GDI32 ;
   String cDriver, String cDeviceName, String cOutput, Long lpInitData

Declare Long DeleteDC in GDI32 Long hDC
Declare Integer GetDeviceCaps in GDI32 Long hDC, Integer nIndex

lc_PrinterName = 'Start The Loop'
Do while !empty( lc_PrinterName )
   lc_PrinterName = alltrim( GetPrinter() )
   If !empty( lc_PrinterName )
      lh_DC = CreateDC( 'WINSPOOL', lc_PrinterName, Null, 0 )
      If (lh_DC != 0)
         Clear
         @ 10,0 say lc_PrinterName
         @ 11,0 say replicate( '-', len( lc_PrinterName ))

         ln_Caps = GetDeviceCaps( lh_DC, TECHNOLOGY )
         ? _ENTER + 'Technology: ' + transform( ln_Caps, '@0' )
         Do case
            Case (ln_Caps == DT_PLOTTER)
               ? '   Vector plotter'
            Case (ln_Caps == DT_RASDISPLAY)
               ? '   Raster display'
            Case (ln_Caps == DT_RASPRINTER)
               ? '   Raster printer'
            Case (ln_Caps == DT_RASCAMERA)
               ? '   Raster camera'
            Case (ln_Caps == DT_CHARSTREAM)
               ? '   Character-stream, PLP'
            Case (ln_Caps == DT_METAFILE)
               ? '   Metafile, VDM'
            Case (ln_Caps == DT_DISPFILE)
               ? '   Display-file'
         EndCase
         ? _ENTER + 'Printer Capabilities:'

         ln_Caps = GetDeviceCaps( lh_DC, CURVECAPS )
         ? '   Curve Capabilities: ' + transform( ln_Caps, '@0' )
         If (ln_Caps == CC_NONE)
            ? '     NOT SUPPORTED'
         else
            If (BitAnd( ln_Caps, CC_CIRCLES ) != 0)
               ? '     Can do Circles'
            endif
            If (BitAnd( ln_Caps, CC_PIE ) != 0)
               ? '     Can do Pie Wedges'
            endif
            If (BitAnd( ln_Caps, CC_CHORD ) != 0)
               ? '     Can do Chord Arcs'
            endif
            If (BitAnd( ln_Caps, CC_ELLIPSES ) != 0)
               ? '     Can do Ellipses'
            endif
            If (BitAnd( ln_Caps, CC_WIDE ) != 0)
               ? '     Can do Wide Line'
            endif
            If (BitAnd( ln_Caps, CC_STYLED ) != 0)
               ? '     Can do Styled Lines'
            endif
            If (BitAnd( ln_Caps, CC_WIDESTYLED ) != 0)
               ? '     Can do Wide Styled Lines'
            endif
            If (BitAnd( ln_Caps, CC_INTERIORS ) != 0)
               ? '     Can do Interiors'
            endif
            If (BitAnd( ln_Caps, CC_ROUNDRECT ) != 0)
               ? '     Can do Rounded Rectangle'
            endif
         endif

         ln_Caps = GetDeviceCaps( lh_DC, TEXTCAPS )
         ? _ENTER + '   Text Capabilities: ' + transform( ln_Caps, '@0' )
         If (ln_Caps == TC_NONE)
            ? '     NOT SUPPORTED'
         else
            If (BitAnd( ln_Caps, TC_OP_CHARACTER ) != 0)
               ? '     Can do Character OutputPrecision'
            endif
            If (BitAnd( ln_Caps, TC_OP_STROKE ) != 0)
               ? '     Can do Stroke OutputPrecision'
            endif
            If (BitAnd( ln_Caps, TC_CP_STROKE ) != 0)
               ? '     Can do Stroke ClipPrecision'
            endif
            If (BitAnd( ln_Caps, TC_CR_90 ) != 0)
               ? '     Can do 90 degree CharRotation'
            endif
            If (BitAnd( ln_Caps, TC_CR_ANY ) != 0)
               ? '     Can do ANY degree CharRotation'
            endif
            If (BitAnd( ln_Caps, TC_SF_X_YINDEP ) != 0)
               ? '     Can do XY Independent ScaleFreedom'
            endif
            If (BitAnd( ln_Caps, TC_SA_DOUBLE ) != 0)
               ? '     Can do DOUBLE Scale'
            endif
            If (BitAnd( ln_Caps, TC_SA_INTEGER ) != 0)
               ? '     Can do INTEGER Scale'
            endif
            If (BitAnd( ln_Caps, TC_SA_CONTIN ) != 0)
               ? '     Can do CONTINUOUS Scale'
            endif
            If (BitAnd( ln_Caps, TC_EA_DOUBLE ) != 0)
               ? '     Can do DOUBLE Embolden'
            endif
            If (BitAnd( ln_Caps, TC_IA_ABLE ) != 0)
               ? '     Can do Italisize'
            endif
            If (BitAnd( ln_Caps, TC_UA_ABLE ) != 0)
               ? '     Can do Underline'
            endif
            If (BitAnd( ln_Caps, TC_SO_ABLE ) != 0)
               ? '     Can do StrikeOut'
            endif
            If (BitAnd( ln_Caps, TC_RA_ABLE ) != 0)
               ? '     Can do RasterFont'
            endif
            If (BitAnd( ln_Caps, TC_VA_ABLE ) != 0)
               ? '     Can do VectorFont'
            endif
            If (BitAnd( ln_Caps, TC_SCROLLBLT ) != 0)
               ? '     Don't do text scroll with blt'
            endif
         endif

         DeleteDC( lh_DC )
      endif
   endif
enddo

Clear Dlls
HTH
Herman
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform