Welcome To The Home Of The Visual FoxPro Experts  
home. signup. forum. archives. search. google. articles. downloads. faq. members. weblogs. file info. rss.
 From: Mike Gagnon
  Where is Mike Gagnon?
 Pointe Claire
 Canada
 Mike Gagnon
 To: Saifuddin Tehami
  Where is Saifuddin Tehami?
 Lahore
 Pakistan
 Saifuddin Tehami
 Tags
Subject: RE: sys(1037) =programtically
Thread ID: 112422 Message ID: 112433 # Views: 2 # Ratings: 0
Version: Visual FoxPro 7 Category: Reports and Printers
Date: Wednesday, November 08, 2006 2:26:08 PM         
   


You can change the struct if you know which values to change, for exmaple PD_ALLPAGES 0 means that the selection in Sys(1037) will be set to print all pages, if you change the value to 2 it will change that selection to printing a page range ect....

#Define PD_ALLPAGES 0
#Define PD_RETURNDC 256
#Define PD_USEDEVMODECOPIESANDCOLLATE 262144 && 0x40000
#Define PD_RETURNDEFAULT 1024 && 0x400
Do setPrinterPrompt

Local lcStruct, hDc, lnFlags
lnFlags = PD_USEDEVMODECOPIESANDCOLLATE + PD_RETURNDC
lcStruct = num2dword(66) +;
    num2dword(0) +;
    num2dword(0) +;
    num2dword(0) +;
    num2dword(0) +;
    num2dword(lnFlags) +;
    num2word(65535) +;
    num2word(65535) +;
    num2word(1) +;
    num2word(65535) +;
    num2word(1) +;
    num2dword(0) +;
    num2dword(0) +;
    num2dword(0) +;
    num2dword(0) +;
    num2dword(0) +;
    num2dword(0) +;
    num2dword(0) +;
    num2dword(0) +;
    num2dword(0)
If PrintDlg (@lcStruct) <> 0
    hDc = buf2dword (Substr (lcStruct, 17, 4))
    = DeleteDC (hDc)
    Messagebox("The user chose the print button")
Else
    Messagebox("The user chose the cancel button.")
Endif

Function num2dword (lnValue)
#Define m0 256
#Define m1 65536
#Define m2 16777216
Local b0, b1, b2, b3
b3 = Int(lnValue/m2)
b2 = Int((lnValue - b3 * m2)/m1)
b1 = Int((lnValue - b3*m2 - b2*m1)/m0)
b0 = Mod(lnValue, m0)
Return Chr(b0)+Chr(b1)+Chr(b2)+Chr(b3)

Function num2word (lnValue)
Return Chr(Mod(m.lnValue,256)) + Chr(Int(m.lnValue/256))

Function buf2dword (lcBuffer)
Return Asc(Substr(lcBuffer, 1,1)) + ;
    Asc(Substr(lcBuffer, 2,1)) * 256 +;
    Asc(Substr(lcBuffer, 3,1)) * 65536 +;
    Asc(Substr(lcBuffer, 4,1)) * 16777216

Procedure SetPrinterPrompt
Declare Integer DeleteDC In gdi32 Integer hdc
Declare Integer PrintDlg In comdlg32;
    STRING @ lppd



> Hi
>
> I want to programatically control the options of the dialog box which noramlly appears with the sys(1037).
>
> I do not want to use the sys(1037), instead change its settings from within the .prg file
>
> Is it possible, how.
>
> regards
> Saif




Mike Gagnon


ENTIRE THREAD

sys(1037) =programtically Posted by Saifuddin Tehami @ 11/8/2006 12:16:57 PM
RE: sys(1037) =programtically Posted by Borislav Borissov @ 11/8/2006 12:26:33 PM
RE: sys(1037) =programtically Posted by Saifuddin Tehami @ 11/8/2006 12:57:16 PM
RE: sys(1037) =programtically Posted by Borislav Borissov @ 11/8/2006 1:10:47 PM
RE: sys(1037) =programtically Posted by Saifuddin Tehami @ 11/8/2006 1:17:45 PM
RE: sys(1037) =programtically Posted by Borislav Borissov @ 11/8/2006 1:33:17 PM
RE: sys(1037) =programtically Posted by Barbara Peisch @ 11/8/2006 8:20:50 PM
RE: sys(1037) =programtically Posted by Mike Gagnon @ 11/8/2006 8:55:58 PM
RE: sys(1037) =programtically Posted by Mike Gagnon @ 11/8/2006 2:26:08 PM
RE: sys(1037) =programtically Posted by Barbara Peisch @ 11/8/2006 9:14:17 PM
RE: sys(1037) =programtically Posted by Mike Gagnon @ 11/8/2006 9:37:38 PM