Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
What's wrong with this Code?
Message
From
03/06/2005 11:32:01
 
General information
Forum:
Visual FoxPro
Category:
Windows API functions
Environment versions
Visual FoxPro:
VFP 8 SP1
OS:
Windows XP SP2
Network:
Windows XP
Database:
Visual FoxPro
Miscellaneous
Thread ID:
01019741
Message ID:
01019931
Views:
46
Hello Borislav.

I just posted my version from Tracy's code message #1019900. have a look at it. i've tested with about 10 different printers , 4 of them OTC dot-matrix, the rest a mix of laser $ inkjet of different companies - including HP.

with the exception of 1 color inkjet (which was offline or disconnected at the time) all other printers were analysed correctly with my code.


>I was very curious how to translate a Tracy's code in Message #1019602 IsPrinterDotMatric().
>I do:
>
>#define NUMCOLORS      24
>#define DC_TRUETYPE    15
>#define DCTT_BITMAP     1
>#define COLORRES      108
>
>cPrinter = GETPRINTER()
>=APRINTERS(aPrnts)
>prtPos = ASCAN(aPrnts,cPrinter,1,-1,1,8)
>
>? IsPrinterMatrix(cPrinter, aPrnts[prtPos, 2])
>
>
>
>
>
>
>FUNCTION IsPrinterMatrix(lcPrinterName, lcPort)
>
>    LOCAL lhPrinterHandler,lbRetVal, lnDC
>
>    lbRetVal = .f. && .f. - Not a DotMatrix Printer
>                   && .t. - DotMatrixc Printer
>
>    lhPrinterHandler = 0
>
>     DECLARE INTEGER GetDeviceCaps IN WIN32API INTEGER hdc,;
>                                               INTEGER nIndex
>
>     DECLARE INTEGER DeviceCapabilities IN winspool.drv  STRING  lpDeviceName,;
>                                                         STRING  lpPort,;
>                                                         LONG    iIndex,;
>                                                         LONG    lpOutput,;
>                                                         LONG    lpDevMode
>
>    DECLARE INTEGER CreateDC IN gdi32 STRING lpszDriver,;
>                                      STRING lpszDevice,;
>                                      STRING lpszOutput,;
>                                      INTEGER lpInitData
>    DECLARE INTEGER DeleteDC IN gdi32 INTEGER lhDC
>
>    lnDC = CreateDC("WINSPOOL", lcPrinterName, lcPort, 0)
>    CLEAR
>    ?
>    ?
>    ? lnDC
>    ? lcPrinterName, lcPort
>    ? "Colors  -", GetDeviceCaps(lnDC, NUMCOLORS)
>    ? "Capabilities-",DeviceCapabilities(lcPrinterName, lcPort, DC_TRUETYPE, 0, 0)
>    IF GetDeviceCaps(lnDC ,NUMCOLORS) <= 16 .AND.;
>       DeviceCapabilities(lcPrinterName, lcPort, DC_TRUETYPE, 0x00, 0x00) == DCTT_BITMAP
>       lbRetVal = .t.
>    ENDIF
>    DeleteDC(lnDC)
>    CLEAR DLLS CreateDC, DeleteDC,;
>               GetDeviceCaps, DeviceCapabilities
>
>RETURN lbRetVal
>
>
>
>But for standart HP LJ (no indexes or any other marks here) driver that comes with WindowsXP the result of the function is .t. I think I do something totaly wrong, but I can't find what.
>
>TIA
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform