Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Use hDC for Printing Active-X Controls
Message
General information
Forum:
Visual FoxPro
Category:
Windows API functions
Miscellaneous
Thread ID:
00249021
Message ID:
00249044
Views:
18
>The help file in ChartFX has an example of the VB code to accomplish what we are trying to do. We haven't worked with Win32API calls. Can anyone give us an example of the syntax in VFP to duplicate the funtionality of the VB Code below?
>

None of the code shown here uses an API call; it's all invoking ActiveX control functions. The question is whether the printer object, which supplies the printer information requires you to go through the WIn32 API to create a DeviceContext for the printer; it's a concept that's foreign to VFP. You'll need to create a Device Context 9there's an API call CreateDC() that does this) and then extract the device's detailed settings. You might check Christof lange's STRUCT class to see if it has support for the Device Context structures built into it; if not, you'll need to deal with a small number of API calls directly to create a Device Context, get the device characteristics from that context, and then release the context after invoking methods of ChartFX that use the printer.hDC and other parameters from VB's printer object.

You might want to consider creating a VB control to create a native VB printer object and pass the required values back through the control's properties if you're more comfortable with VB.

>Sub PrintFillingPage ()
>Dim l, r, t, b As Integer 'left,right,top and bottom
>Printer.Print ""
>px = Printer.TwipsPerPixelX
>py = Printer.TwipsPerPixelY
>w = Printer.Width
>h = Printer.Height
>gap = 100 / px
>t = gap
>b = ((h / 2) / py) - gap
>l = gap
>r = (w / px) - gap / 2
>ChartFX1.Paint Printer.hDC, l, t, r, b, CPAINT_PRINT, 0
>t = b
>b = (h / py) - gap
>ChartFX1.Paint Printer.hDC, l, t, r, b, CPAINT_PRINT, 0
>Printer.EndDoc
>End Sub
>
>
>Thanks!
>Bill Dimes
EMail: EdR@edrauh.com
"See, the sun is going down..."
"No, the horizon is moving up!"
- Firesign Theater


NT and Win2K FAQ .. cWashington WSH/ADSI/WMI site
MS WSH site ........... WSH FAQ Site
Wrox Press .............. Win32 Scripting Journal
eSolutions Services, LLC

The Surgeon General has determined that prolonged exposure to the Windows Script Host may be addictive to laboratory mice and codemonkeys
Previous
Reply
Map
View

Click here to load this message in the networking platform