Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
IsPrinterDotMatric()
Message
From
02/06/2005 17:23:19
 
 
To
02/06/2005 17:08:18
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Environment versions
Visual FoxPro:
VFP 6 SP5
OS:
Windows XP SP2
Network:
Windows NT
Database:
Visual FoxPro
Miscellaneous
Thread ID:
01019594
Message ID:
01019602
Views:
52
This message has been marked as the solution to the initial question of the thread.
It should be possible using the API. I have some Delphi code from the internet that does it. It will have to be converted to VFP and tested.
{$APPTYPE CONSOLE}
uses Windows, Printers, WinSpool, Variants;

function IsPrinterMatrix: Boolean;
var
  DeviceMode: THandle;
  Device, Driver, Port: array [0..79] of Char;
  pDevice, pDriver, pPort: PChar;
begin

  // Determinate that active printer is a Dot-Marix
  Result:= False;
  pDevice := @Device;
  pDriver := @Driver;
  pPort   := @Port;

  Device  := #0;
  Driver  := #0;
  Port    := #0;

  Printer.GetPrinter(pDevice, pDriver, pPort, DeviceMode);

  // Printer is dot-matrix when number of maximum colors = 16
  // and when printer prints TRUETYPE fonts as graphics

  if (GetDeviceCaps(Printer.Handle,NUMCOLORS)<=16) and
     (DeviceCapabilities(pDevice, pPort,DC_TRUETYPE,nil,nil) = DCTT_BITMAP)
  then
    Result := True;
end;

begin
  writeln ('The current printer is ', Printer.Printers[Printer.PrinterIndex]);

  if IsPrinterMatrix then
    writeln('Dot-Matrix Printer')
  else
    writeln('LaserJet or InkJet Printer');
end.
>hello everybody.
>
>has anyone found a way to determine if a printer is a Dot-Matrix printer? as far as i know, there is no direct way. i was thinking this might be possible by checking for the lack of or the existense of a printer capability or simular.
>
>any ideas?
.·*´¨)
.·`TCH
(..·*

010000110101001101101000011000010111001001110000010011110111001001000010011101010111001101110100
"When the debate is lost, slander becomes the tool of the loser." - Socrates
Vita contingit, Vive cum eo. (Life Happens, Live With it.)
"Life is not measured by the number of breaths we take, but by the moments that take our breath away." -- author unknown
"De omnibus dubitandum"
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform