Recent

Author Topic: Printer.handle  (Read 10465 times)

Lothar

  • Newbie
  • Posts: 2
    • http://www.reschke.de
Printer.handle
« on: April 16, 2007, 03:26:40 pm »
Hello!

As I have seen in the tprinter description (and as the compiler says when trying to compile), the handle property does not exist. I try to port a delphi application and get problems with the following tasks:

1. Using the "PASSTHROUGH"-mode (this is old, I know):
    (Test to see if the "PASSTHROUGH" escape is supported
     Escape(Printer.Handle,QUERYESCSUPPORT,...
     
     Escape(Printer.Handle,PASSTHROUGH,...

2. Using SetTextAlign:
    SetTextAlign(printer.handle,TA_RIGHT...

3. Using GetDeviceCaps:
    dpi_x:=getDeviceCaps(printer.handle,logpixelsx)
    (Is this done with XDPI,YDPI?)

But especially:
4.  SetMapmode(printer.handle,...

which I need in any case.

Thanks for help
Lothar

antonio

  • Hero Member
  • *****
  • Posts: 605
RE: Printer.handle
« Reply #1 on: April 16, 2007, 04:25:30 pm »
var Buffer :pchar;
SendMessage(Handle, EM_REPLACESEL, 0, LongInt(Buffer));

Compiler said this conversion pointer-longint is not portable. Should it be portable some day?
What way should we take in these cases? To wait until these items could be ported or take the way of work around them as a determinate solution?

Vincent Snijders

  • Administrator
  • Hero Member
  • *
  • Posts: 2661
    • My Lazarus wiki user page
RE: Printer.handle
« Reply #2 on: April 16, 2007, 05:17:03 pm »
In this case:
SendMessage(Handle, EM_REPLACESEL, 0, LParam(Buffer));

Generally:
SendMessage(Handle, EM_REPLACESEL, 0, PtrInt(Buffer));

Lothar

  • Newbie
  • Posts: 2
    • http://www.reschke.de
Printer.handle
« Reply #3 on: April 16, 2007, 07:32:35 pm »
Sorry, but I don't understand what this has to do with my questions.

Vincent Snijders

  • Administrator
  • Hero Member
  • *
  • Posts: 2661
    • My Lazarus wiki user page
Printer.handle
« Reply #4 on: April 16, 2007, 07:49:49 pm »
Quote from: "Lothar"
Sorry, but I don't understand what this has to do with my questions.
I think, nothing.

But I still wanted to answer the other message.

antonio

  • Hero Member
  • *****
  • Posts: 605
Printer.handle
« Reply #5 on: April 16, 2007, 08:42:24 pm »
Quote from: "Lothar"
Sorry, but I don't understand what this has to do with my questions.

I added my questions to yours because of the similar portability issue.

Thanks, Vincent.

lfrodrigues

  • New Member
  • *
  • Posts: 25
Printer.handle
« Reply #6 on: August 22, 2007, 06:32:43 pm »
Hello,

in Windows you can include OSPrinters and do TWinPrinter(Printer).Handle in Linux I don't know any way of doing that.

antonio

  • Hero Member
  • *****
  • Posts: 605
Printer.handle
« Reply #7 on: August 22, 2007, 11:24:09 pm »
Probably the Printers4Lazarus package is cross-platform.

 

TinyPortal © 2005-2018