Printer Matrix or Laser ?

231 views
Skip to first unread message

Rossine

unread,
May 15, 2012, 2:03:53 PM5/15/12
to Harbour Users
Hello,

How tell if the printer is Laser or Matrix ?

Regards,

Rossine.

Klas Engwall

unread,
May 15, 2012, 3:15:28 PM5/15/12
to harbou...@googlegroups.com
Hi Rossine,

> How tell if the printer is Laser or Matrix ?

By checking the noise level while printing :-)

But seriously, I don't think you can get that kind of info. Here is a
page that describes the printer properties you can get from Windows:

http://www.thedbcommunity.com/index.php?option=com_content&task=view&id=218&Itemid=56

It is Paradox related, but the WinApi data structs are described so you
can see what info is available.

Regards,
Klas

wgreg66

unread,
May 15, 2012, 4:52:45 PM5/15/12
to Harbour Users
Hi Rossine,

Try code.

FUNCTION Main()

Local oPrinter:=Win_Prn():New(Win_PrinterGetDefault())

If
ISDOTPRINTER(oPrinter,Win_PrinterGetDefault(),Win_PrinterGetDefault())
?'Dot printer - YES'
Else
?'Dot printer - NO'
EndIf

RETURN NIL

#pragma BEGINDUMP

#include <windows.h>
#include "hbapi.h"

HB_FUNC( ISDOTPRINTER )
{
HDC hDC = (HDC) hb_parnl(1) ;
LPCSTR pPrinterName = hb_parcx(2) ;
LPCSTR pPort = hb_parcx(3) ;

// Printer can be dot-matrix when number of colors is maximum 16
// and when printer is capable to print only for TRUETYPE
// fonts as graphics (dot-matrix and PCL printers are capable for
that).

if( ( GetDeviceCaps( hDC, NUMCOLORS) <= 16 )
&&( DeviceCapabilities( pPrinterName, pPort,DC_TRUETYPE, NULL, NULL )
== DCTT_BITMAP ) )
hb_retl(TRUE);
else
hb_retl(FALSE);
}

#pragma ENDDUMP

Regards
Grzegorz

tsakal

unread,
May 16, 2012, 2:41:22 AM5/16/12
to Harbour Users
It's working.

Thank you very much
Evangelos

Rossine

unread,
May 16, 2012, 7:10:52 AM5/16/12
to Harbour Users
Hi Grzegorz,

Many thank´s for this solution. His work´s fine :)

Hi Klas,

Many thank´s for this explanation :)

Best Regards,

Rossine.

Reply all
Reply to author
Forward
0 new messages