Re: [fpc-pascal] raw printing throught USB port / WINDOWS

2015-01-13 Thread Philippe

Em 16.12.2014 10:35, LacaK escreveu:


Is the printer already known to Windows (can you print to that printer
from others windows applications) ?
If yes, then you can use:
Printer.SetPrinter('Printer name');
-Laco.


Em 16.12.2014 09:27, LacaK escreveu:


You can use:
Printer.RawMode := True;
Printer.BeginDoc;

Printer.EndDoc;
-Laco.



Thank you, but that the part I already knew (saw it searching in
Google).

The question is how to select the USB port and create Printer (
win32/win


5px; width: 100%;">

; margin-left: 5px; width: 100%;">

I need a solution (unit?) to access printer (matricial


win32 or win64.

apreciate any ideia

thanks

Philippe
-



I have been busy with other stuff ... back to this topic!

First: could anyone tell me I have the possibility to access USB 
printer in raw mode with the "basic" FPC package (not using Lazarus 
packages/components)?





___
fpc-pascal maillist - fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal [1]




Links:
--
[1] http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal


Re: [fpc-pascal] raw printing throught USB port / WINDOWS

2015-01-13 Thread Virgo Pärna
On Tue, 13 Jan 2015 10:41:55 -0200, Philippe  wrote:
>
> First: could anyone tell me I have the possibility to access USB 
> printer in raw mode with the "basic" FPC package (not using Lazarus 
> packages/components)?
>

If you have USB printer installed , then winunits-base package has winspool 
unit.
Following sample is with string beeing ansisstring and Char AnsiChar.

procedure PrintCodesToPrinter(const APrinterName, APrintData: string);
type
  TDoc_Info_1 = record
DocName,
OutputFile,
Datatype: PChar;
  end;
var
  Written: DWORD;
  DocInfo: TDoc_Info_1;
  PHandle: THandle;
begin
  if APrintData = '' then //nothing to print
exit;
  DocInfo.DocName := 'POS';
  DocInfo.OutputFile := nil;
  DocInfo.Datatype := 'RAW';
  if not OpenPrinter(PChar(APrinterName), PHandle, nil) then
raise Exception.CreateFmt('Error opening printer "%s"',
[APrinterName]);
  try
StartDocPrinter(PHandle, 1, @DocInfo);
StartPagePrinter(PHandle);
WritePrinter(PHandle, @APrintData[1], Length(APrintData), Written);
EndPagePrinter(PHandle);
EndDocPrinter(PHandle);
  finally
ClosePrinter(PHandle);
  end;
end;

-- 
Virgo Pärna 
virgo.pa...@mail.ee

___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal

Re: [fpc-pascal] raw printing throught USB port / WINDOWS

2015-01-13 Thread Chriss Kalogeropoulos
Hi,

map the USB Port to a Virtual Serial Port and open the Port as File using
CreateFile using name "\\.\COMxxx"
Then write to the port with the usual API file commands

Even better wrap  this to a Stream (or FileStream) descendant and use
Stream.Write commands
Read and Seek should do nothing

I hope this helps

Chriss


On Tue, Jan 13, 2015 at 3:13 PM, Virgo Pärna  wrote:

> On Tue, 13 Jan 2015 10:41:55 -0200, Philippe 
> wrote:
> >
> > First: could anyone tell me I have the possibility to access USB
> > printer in raw mode with the "basic" FPC package (not using Lazarus
> > packages/components)?
> >
>
> If you have USB printer installed , then winunits-base package has
> winspool unit.
> Following sample is with string beeing ansisstring and Char AnsiChar.
>
> procedure PrintCodesToPrinter(const APrinterName, APrintData: string);
> type
>   TDoc_Info_1 = record
> DocName,
> OutputFile,
> Datatype: PChar;
>   end;
> var
>   Written: DWORD;
>   DocInfo: TDoc_Info_1;
>   PHandle: THandle;
> begin
>   if APrintData = '' then //nothing to print
> exit;
>   DocInfo.DocName := 'POS';
>   DocInfo.OutputFile := nil;
>   DocInfo.Datatype := 'RAW';
>   if not OpenPrinter(PChar(APrinterName), PHandle, nil) then
> raise Exception.CreateFmt('Error opening printer "%s"',
> [APrinterName]);
>   try
> StartDocPrinter(PHandle, 1, @DocInfo);
> StartPagePrinter(PHandle);
> WritePrinter(PHandle, @APrintData[1], Length(APrintData), Written);
> EndPagePrinter(PHandle);
> EndDocPrinter(PHandle);
>   finally
> ClosePrinter(PHandle);
>   end;
> end;
>
> --
> Virgo Pärna
> virgo.pa...@mail.ee
>
> ___
> fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
> http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
>
___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal

[fpc-pascal] Debug information

2015-01-13 Thread Rainer Stratmann
Can not get debug information

-g -gl -gw 

switched on

but no further information (line nr) is displayed when an error occured.
___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal


Re: [fpc-pascal] Debug information

2015-01-13 Thread Martin Frb

On 13/01/2015 14:40, Rainer Stratmann wrote:

Can not get debug information

-g -gl -gw

switched on

but no further information (line nr) is displayed when an error occured.


-gl  has a "feature" it prints the stack info, until it finds an address 
for which there is no stack info (e.g. in the rtl, if the rtl was not 
compiled with info).


IIRC this is to avoid issues if an error occurred while getting line 
info. But not sure.


So if your first address is not in code with debug info, then that is it.

If you run in the debugger, or resolve with leak-view then this will not 
happen. But ofcourse if the error occurs with either a corrupted stack, 
or in some code (e.g system kernal) that does not use stackframes then 
the stack can not always be parsed.

___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal


Re: [fpc-pascal] Debug information

2015-01-13 Thread Jonas Maebe


On 13 Jan 2015, at 16:14, Martin Frb wrote:


On 13/01/2015 14:40, Rainer Stratmann wrote:

Can not get debug information

-g -gl -gw

switched on

but no further information (line nr) is displayed when an error  
occured.


-gl  has a "feature" it prints the stack info, until it finds an  
address for which there is no stack info (e.g. in the rtl, if the  
rtl was not compiled with info).


No, it only stops printing line info for both the current and all  
future backtraces if an error occurs during the reading/decoding of  
the line information. If no line info is found for a particular  
address, nothing special happens.


However, -gl is not fully functional on platforms. E.g., it doesn't  
work for DWARF on (Mac) OS X.



Jonas

___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal