programming tools for Windows applications development
  Home  |   SwiftForth Archive  |   SwiftX Archive  |

Pirnting Line drawings

From: Anil Rodrigues <arodrix_at_weld.com>
Date: Fri, 3 Nov 2006 11:44:06 -0500

I am trying to print shapes composed of lines and arcs, using the
same commands used to show them on the screen. As a starting point I
have the code below modified from SFTalk archives.

The problem is "try" only prints once, then doesn't work again.
Defining a word from "try" without the first 2 lines to get pdc
works - so the question is in that case what is being left floating
that I have to close? Also I would expect try to open a Print Dialog
Box, but it goes straight to the printer and prints.

Any suggestions or comments welcome,

Thanks and Cheers!
Anil
-------------------------------------------------------------------
\ >From marc_hawley_at_email.msn.com Fri Jan 1 21:36:10 1999
\ (edited)

create pd.struct \ this is NON-relocatable data
 66 , \ size in bytes
 NULL , \ owner
 NULL , \ hDevmode
 NULL , \ hDevnames
 NULL , \ hDC - offset 16
 PD_RETURNDC
 PD_RETURNDEFAULT OR , \ flag, get default printer DC
 0 c, 0 c, \ from page - how else to compile 16?
 0 c, 0 c, \ to page
 0 c, 0 c, \ min
 0 c, 0 c, \ max
 0 c, 0 c, \ copies
 NULL , \ hInstance
 NULL , \ custdata
 NULL , \ printhook
 NULL , \ setup hook
 NULL , \ prtempllate
 NULL , \ setteplate
 NULL , \ h
 NULL , \ h

\ PrintDlg is a known proc, takes one parameter - addr of structure

 3 Import: LineTo \ dc x y -- int
 5 import: Rectangle

: testpr pd.struct PrintDlg drop ;

create mydocinfo \ NON-relocatable data
 20 , \ size in bytes
 z" TEST DOCUMENT" , \ name of document
 NULL , \ send to device, not file
 NULL , \ type of data?
 0 , \ do not use banding

0 value pdc \ value for printer device context

: try ( -- )
 pd.struct PrintDlg drop
 pd.struct 16 + @ to pdc \ get dc

 pdc mydocinfo StartDoc drop \ StartDoc is a known proc in swiftforth
     pdc StartPage drop
  pdc 50 50 2000 3000 Rectangle drop
  pdc 100 100 s" hello printer " TextOut drop
  pdc 200 200 s" page ONE " TextOut drop
  pdc 1000 1000 LineTo drop
     pdc EndPage drop
 pdc EndDoc drop

\ pdc ( DeleteDC) ( ReleaseDC) ( ?)
 ;

\\

-----------------------------------------------------------
----------------------------------------------------------------------
sftalk_at_forth.com The SwiftForth programming discussion email list
To unsubscribe, send subject "unsubscribe" to sftalk-request_at_forth.com
For list command help, send subject "help" to sftalk-request_at_forth.com
Message archives are located at http://www.forth.com/archive/sftalk
----------------------------------------------------------------------
This list is a forum for SwiftForth users. For product support and
bug reports, please send email to support_at_forth.com
----------------------------------------------------------------------
Received on Fri Nov 03 2006 - 08:44:45 PST

This archive was generated by hypermail 2.2.0 : Wed Nov 19 2008 - 03:04:28 PST