For Programmers: Free Programming Magazines  


Home > Archive > APL > September 2005 > PRINTWINDOW with APL+Win









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author PRINTWINDOW with APL+Win
AA2e72E

2005-09-20, 3:55 am

PRINTWINDOW is an Win32 API that allows a copy of a form to be printed via
code.

PRINTWINDOW (handle of form) (hdc of printer) 0

When I run this, there is a document shown as spooling in the printer
properties but the page never comes out, not even qhe quadtcff is sent to
the printer. What am I missing?

David Liebtag

2005-09-20, 6:58 pm

Although the Microsoft documentation does not say how PrintWindow works, my
guess would be that PrintWindow sends the window a WM_PRINT message. Not
all windows support WM_PRINT messages. In particular, Windows' default
dialog procedure does not. Unless APL+Win includes code to handle WM_PRINT,
I doubt PrintWindow would work.

David Liebtag


AA2e72E

2005-09-21, 3:55 am

Thanks for the response, David.
I know that the PRINTWINDOW API works with Windows XP and, with APL+Win,
it works if I use the hdc of the Picture class on a FORM.
I had tried to use WM_PRINT via the SendMessage API but that did not work
either.
What I am trying to do is to print the form containing a Picture class
that is displaying charts produced by Excel.

Graham Steer

2005-09-21, 7:55 am

Have you tried using the Printer class you can draw to that in much the same
way as a Picture class and it will print its contents to the default printer
on receiving a close command.


"AA2e72E" <aa2e72e@lycos.co.uk> wrote in message
news:5f46bb79431cac871316f9995ade3da0@lo
calhost.talkaboutprogramming.com...
> Thanks for the response, David.
> I know that the PRINTWINDOW API works with Windows XP and, with APL+Win,
> it works if I use the hdc of the Picture class on a FORM.
> I had tried to use WM_PRINT via the SendMessage API but that did not work
> either.
> What I am trying to do is to print the form containing a Picture class
> that is displaying charts produced by Excel.
>



AA2e72E

2005-09-21, 7:55 am

I tried using the Draw method. I can get the bitmap/chart printed.

'pr' quadwi 'Create' 'Printer'
'pr' quadwi 'Draw' ('Bitmap' 'c:\zz\xx.bmp')
'pr' quadwi 'Close'

BUT: how do control the size of the printed image & centre tit on the
page?

At present, I get a thumbnail printed on the top left-hand corner of the
page. I ave experimented with the 'scale' property without success.

Graham Steer

2005-09-24, 6:55 pm

I responded privately to your last question. Did you receive it. One more
thought. How are you getting the charts from Excel. If you are interfacing
directly with Excel via DDE or as a Com object then why not instruct Excel
to initiate the print job.


"AA2e72E" <aa2e72e@lycos.co.uk> wrote in message
news:c2beeb0b0af4238f7970d76bfb494697@lo
calhost.talkaboutprogramming.com...
> I tried using the Draw method. I can get the bitmap/chart printed.
>
> 'pr' quadwi 'Create' 'Printer'
> 'pr' quadwi 'Draw' ('Bitmap' 'c:\zz\xx.bmp')
> 'pr' quadwi 'Close'
>
> BUT: how do control the size of the printed image & centre tit on the
> page?
>
> At present, I get a thumbnail printed on the top left-hand corner of the
> page. I ave experimented with the 'scale' property without success.
>



Sponsored Links







Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive

Copyright 2008 codecomments.com