Richard Kaye wrote on 2010-08-23:
> I think this may have been where I found someone who wrote that code
> for me... <g> The gist of it is in the INIT method.
>
> http://www.tech-
> archive.net/Archive/Fox/microsoft.public.fox.vfp.reports.printing/2006 -
> 08/msg00012.html
>
> rk
>
Richard,
>From what I am seeing in that code it is getting the list of paper bins. I
am not seeing which is currently set as the default.
With VFP 9, what I'm looking for is acquired easily enough. I use Crystal
Reports for most of our products. So the number that is put into the Expr
field is the number I need to pass to CR.
I put together a class to pull the SYS(1037,2) information into a
collection.
*-- Test
LOCAL oPrintSettings
ACTIVATE SCREEN
CLEAR
SET PRINTER TO NAME GETPRINTER()
oPrinterSettings = CREATEOBJECT("PrinterSettings")
IF oPrinterSettings.Settings.Count < 1
?"No printer information could be acquired."
RETURN
ENDIF
?"** Current VFP Printer **"
FOR SettingsLoop = 1 TO oPrinterSettings.Settings.Count
?oPrinterSettings.Settings.GetKey(SettingsLoop),"="
?oPrinterSettings.Settings(SettingsLoop)
NEXT
SET PRINTER TO NAME SET("PRINTER", 2)
oPrinterSettings.GetInfo()
?""
?"** Windows default printer **"
FOR SettingsLoop = 1 TO oPrinterSettings.Settings.Count
?oPrinterSettings.Settings.GetKey(SettingsLoop),"= "
?oPrinterSettings.Settings(SettingsLoop)
NEXT
?""
* Tracy Pearson 8/23/2010
* This class will fill a SETTINGS collection of the current FoxPro printer
* To get the default Windows printer use the following:
* SET PRINTER TO NAME SET("PRINTER", 2)
DEFINE CLASS PrinterSettings as Session
SETTINGS = .NULL.
PROCEDURE Init
THIS.GetInfo()
ENDPROC
PROCEDURE Destroy
THIS.SETTINGS = .NULL.
ENDPROC
PROCEDURE GetInfo
LOCAL ExprLoop, CurrentLine, SettingName, SettingValue
THIS.GetTable()
SYS(1037, 2)
THIS.SETTINGS = .NULL.
THIS.SETTINGS = CREATEOBJECT("Collection")
FOR ExprLoop = 1 TO MEMLINES(Expr)
CurrentLine = MLINE(Expr, ExprLoop)
IF NOT EMPTY(CurrentLine)
SettingName = GETWORDNUM(CurrentLine, 1, "=")
SettingValue = SUBSTR(CurrentLine, LEN(SettingName)
+ 2)
THIS.SETTINGS.Add(SettingValue, SettingName)
ENDIF
NEXT
ENDPROC
PROCEDURE GetTable()
*-- VFP 9 Help File
*-- SET BLOCKSIZE is scoped to the current data session.
SET BLOCKSIZE TO 33
CREATE CURSOR PrinterInfo ;
( "PLATFORM" C(8);
, "UNIQUEID" C(10);
, "TIMESTAMP" N(10);
, "OBJTYPE" N(2);
, "OBJCODE" N(3);
, "NAME" M;
, "EXPR" M;
, "VPOS" N(9,3);
, "HPOS" N(9,3);
, "HEIGHT" N(9,3);
, "WIDTH" N(9,3);
, "STYLE" M;
, "PICTURE" M;
, "ORDER" M NOCPTRANS;
, "UNIQUE" L;
, "COMMENT" M;
, "ENVIRON" L;
, "BOXCHAR" C(1);
, "FILLCHAR" C(1);
, "TAG" M;
, "TAG2" M NOCPTRANS;
, "PENRED" N(5);
, "PENGREEN" N(5);
, "PENBLUE" N(5);
, "FILLRED" N(5);
, "FILLGREEN" N(5);
, "FILLBLUE" N(5);
, "PENSIZE" N(5);
, "PENPAT" N(5);
, "FILLPAT" N(5);
, "FONTFACE" M;
, "FONTSTYLE" N(3);
, "FONTSIZE" N(3);
, "MODE" N(3);
, "RULER" N(1);
, "RULERLINES" N(1);
, "GRID" L;
, "GRIDV" N(2);
, "GRIDH" N(2);
, "FLOAT" L;
, "STRETCH" L;
, "STRETCHTOP" L;
, "TOP" L;
, "BOTTOM" L;
, "SUPTYPE" N(1);
, "SUPREST" N(1);
, "NOREPEAT" L;
, "RESETRPT" N(2);
, "PAGEBREAK" L;
, "COLBREAK" L;
, "RESETPAGE" L;
, "GENERAL" N(3);
, "SPACING" N(3);
, "DOUBLE" L;
, "SWAPHEADER" L;
, "SWAPFOOTER" L;
, "EJECTBEFOR" L;
, "EJECTAFTER" L;
, "PLAIN" L;
, "SUMMARY" L;
, "ADDALIAS" L;
, "OFFSET" N(3);
, "TOPMARGIN" N(3);
, "BOTMARGIN" N(3);
, "TOTALTYPE" N(2);
, "RESETTOTAL" N(2);
, "RESOID" N(3);
, "CURPOS" L;
, "SUPALWAYS" L;
, "SUPOVFLOW" L;
, "SUPRPCOL" N(1);
, "SUPGROUP" N(2);
, "SUPVALCHNG" L;
, "SUPEXPR" M;
, "USER" M)
*-- SYS(1037, 2) will error without one row of data.
APPEND BLANK
ENDPROC
ENDDEFINE
Tracy Pearson
PowerChurch Software
_______________________________________________
Post Messages to: [email protected]
Subscription Maintenance: http://leafe.com/mailman/listinfo/profox
OT-free version of this list: http://leafe.com/mailman/listinfo/profoxtech
Searchable Archive: http://leafe.com/archives/search/profox
This message:
http://leafe.com/archives/byMID/profox/000001cb4391$50775d70$f16618...@com
** All postings, unless explicitly stated otherwise, are the opinions of the
author, and do not constitute legal or medical advice. This statement is added
to the messages for those lawyers who are too stupid to see the obvious.