Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Printer Stuff
Message
From
21/02/1999 06:14:55
Walter Meester
HoogkarspelNetherlands
 
 
General information
Forum:
Visual FoxPro
Category:
Windows API functions
Title:
Miscellaneous
Thread ID:
00189600
Message ID:
00189773
Views:
12
Ed,

>The first looks to be the easiest approach if it works, and the report isn't embedded in a .EXE or .APP file. What about making a local copy of the .FRX/FRT files at runtime, and then hacking the TAG2 structure locally? You couldd then run report from the local copy rather than the shared image, with the DEVMODE structure you've hacked in place...

I've tried this approach.... It seems to work for some settins, like orientation and paper size, But some driver specific stuff don't seems to hold. When i select (with document properties) that my report should be printed in gray-scale only, it still prints colors (default setting).

>The second approach would be to rip out the DEVMODE structure and force it to be in place the way you want it as the first thing done in the report header with a UDF. I'm not certain that VFP uses the DocumentProperties() API call - it might well be using SetPrinter() instead; you can set default properties for a session with SetPrinter() at level 2 via a PRINTER_INFO_2 structure, which takes a pointer to a DEVMODE structure as a member. This might also be a way to force VFP to set print modes not directly supported by the report designer.

I've thouht off this, but how i'm supposed to hack into the printer job. I don't have a HDC nor a HANDLE to the printerjob.

>You might well need to clean up the printer's state after the report finishes. You can grab the state of the printer with GetPrinter() at level 2, and save the PRINTER_INFO_2 structure. I'd also save everything pointed at by the PRINTER_INFO_2 structure and reallocate them to new string buffers (CLSHEAP can handle the allocation task, and the new AllocString method makes coding to save a string cleaner than making separate calls in your code to Alloc and CopyTo), adjusting the embedded pointers in the saved PRINTER_INFO_2 before calling SetPrinter() at the end to restore the state.

>As mentioned, I haven't tried either of these. You might ask George Tasker if he's got any insights into the relationship between VFP's report engine and the printer API.

Thanks, i'll do that..

>TheWindows NT WIN32 API SuperBible devotes about 70 pages to the various printer APIs; you might find it helpful if you decide to try using the API.

How can i get this Windows NT WIN32 API SuperBible ?


Thanks in advandce..


Walter
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform