Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Printing Active Form as report
Message
From
07/02/2002 14:49:14
 
 
To
07/02/2002 14:34:21
General information
Forum:
Visual FoxPro
Category:
Forms & Form designer
Miscellaneous
Thread ID:
00616687
Message ID:
00616920
Views:
23
Sorry about that. Here it is.


*PROCEDURE PrintWindow
LPARAMETERS tnHWnd, tcJobName

LOCAL lcJobName && Print job name
LOCAL lnRetVal && Return value from API functions

DECLARE INTEGER PrintWindow IN DibApi32 ;
INTEGER HWnd, ;
INTEGER fPrintArea, ;
INTEGER fPrintOpt, ;
INTEGER wxScale, ;
INTEGER wyScale, ;
STRING @ szJobName

*!* Print entire window or just client area
#DEFINE PW_WINDOW 1
#DEFINE PW_CLIENT 2

*!* How to size the printed image
*!* PW_BESTFIT resizes to fill paper while retaining proportions
*!* PW_STRETCHTOPAGE resizes to completely fill paper, distorts proportions
*!* PR_SCALE scale print size
#DEFINE PW_BESTFIT 1
#DEFINE PW_STRETCHTOPAGE 2
#DEFINE PW_SCALE 3

*!* If you are not including FoxPro.H uncomment these lines
*!* #DEFINE MB_ICONEXCLAMATION 48
*!* #DEFINE MB_OK 0

lcJobName = tcJobName + CHR(0)
lnRetVal = PrintWindow( tnHWnd, PW_WINDOW, PW_BESTFIT, 0, 0, @lcJobName)
IF lnRetVal != 0
IF lnRetVal != 6 && 6 = User canceled printing
= MESSAGEBOX("Unable to print the window" + CRLF + ;
"PrintWindow API call returned " + STR(lnRetVal), ;
MB_ICONEXCLAMATION + MB_OK, ;
"ERROR MESSAGE TITLE")
ENDIF
ENDIF
*RETURN




>Hello Dale,
>
>It appears your application class has a method called PrintWindow(). What code is in that method()?
>
>>I'm pretty sure I received this tip from somebody on the UT a couple years ago. Wish I knew who to give the credit to. Anyway, the following works for me.
>>
>>I created a button on my toolbar to hold the following code:
>>
>>if type("_screen.activeform") = "O"
>> _screen.activeform.printform()
>>else
>> wait wind "You can't use this unless an application form is active"
>>endif
>>
>>In my form class I added a method called printform. The following is the code for that method.
>>
>>DECLARE INTEGER GetFocus IN WIN32API
>> oApp.PrintWindow(GetFocus(), "PRINT JOB TITLE")
>>
>>Hope this helps.
>>
>>Dale
>>
>>
>>
>>>How would you give user ability to screen print only active form to
>>>printer and specify landscape / portrait?
>>>I want to prevent having to re-draw the form as a report since the
>>>form is excactly what needs to print.
>>>I know user can do screen print but it will have all of the background
>>>stuff in it.
>>>
>>>thanks in advance.
>>>
>>>Ronnie
Previous
Reply
Map
View

Click here to load this message in the networking platform