Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Sys(1037) make it stick!!
Message
From
11/05/2009 15:53:22
 
 
To
10/05/2009 03:48:43
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Miscellaneous
Thread ID:
01398449
Message ID:
01399215
Views:
67
ok piecing this together from an small army of programmers i am gradually getting my answers.
Naomi sent me this connection Message #1324917 from Simon which gave me the papersize code that i neded - # 7. ( i am looking for executive default in my printer setup. )

Below that Herman Tan's blog on getting paper size programmatically sent to me by Koen - which is now part of my arsonal. So my understanding was that if i substitute the 7 in the original code for 2 (#Define DC_PAPERS_Size 2) i was expecting to see 'executive' as default when i pressed sys(1037) - but i was crushed to see 'letter' size still appearing.

Can anyone help me? Right now i have operator entering "executive" as paper size choice each time the printer comes on for first time.

I am grateful for everyone's help so far.

k

* Windows Paper Sizes &&peter's default code
*======================================
#DEFINE DMPAPER_LEGAL 5
#DEFINE DMPAPER_STATEMENT 6
#DEFINE DMPAPER_EXECUTIVE 7
#DEFINE DMPAPER_A3 8

*********************************************herman's code
#Define DC_PAPERS 2
#Define DC_PAPERS_Size 2 &&& HERE IS CHANGED 2 FOR 7
#Define DC_PAPERNAMES 7
#Define DC_PAPERNAMES_Size 64
Declare Long DeviceCapabilities In WinSpool.drv ;
String cPrinterName, String cPort, Short nCapFlags, ;
String @O_cBuffer, Long pDevMode
Local Array la_Printer[1]
Local ln_Row, ln_Result, ln_I, ln_Index
Local lc_PrinterName, lc_Buffer
Local lc_FindPaperName, lc_PaperName, lc_PaperSizeID
lc_PrinterName = Set( 'Printer', 2 ) && Get default windows printer
= Aprinters( la_Printer )
ln_Row = Ascan( la_Printer, lc_PrinterName, 1, 0, 0, 9 )
ln_Result = DeviceCapabilities( la_Printer[ ln_Row, 1 ], ;
la_Printer[ ln_Row, 2 ], DC_PAPERNAMES, 0, 0 )
If (ln_Result > 0)
ln_Index = -1
lc_FindPaperName = Upper( 'MyCustom - Half A4' )
lc_Buffer = Replicate( Chr(0), ln_Result * DC_PAPERNAMES_Size )
ln_Result = DeviceCapabilities( la_Printer[ ln_Row, 1 ], ;
la_Printer[ ln_Row, 2 ], DC_PAPERNAMES, @lc_Buffer, 0 )
For ln_I = 0 To ln_Result-1
lc_PaperName = Upper( Substr( lc_Buffer, (ln_I * DC_PAPERNAMES_Size )+1, ;
DC_PAPERNAMES_Size ))
If (lc_FindPaperName $ lc_PaperName)
ln_Index = ln_I
Exit
Endif
Next
If (ln_Index != -1)
** Paper Name found
** Get PaperSize ID
ln_Result = DeviceCapabilities( la_Printer[ ln_Row, 1 ], ;
la_Printer[ ln_Row, 2 ], DC_PAPERS, 0, 0 )
If (ln_Result > 0)
lc_Buffer = Replicate( Chr(0), ln_Result * DC_PAPERS_Size )
ln_Result = DeviceCapabilities( la_Printer[ ln_Row, 1 ], ;
la_Printer[ ln_Row, 2 ], DC_PAPERS, @lc_Buffer, 0 )
lc_PaperSizeID = Substr( lc_Buffer, (ln_Index * DC_PAPERS_Size )+1, DC_PAPERS_Size )
? 'PaperSize ID for "' + lc_FindPaperName + '" is', CToBin( lc_PaperSizeID, '2rs' )
Endif
Endif
Endif
Previous
Reply
Map
View

Click here to load this message in the networking platform