Call this code from a method or event of FoxPro form to print image of the form on your default printer. Window handle of the form is obtained through GetFocus function. That is why this form has to be active, possessing the keyboard focus.
This code sample is based on Enhanced Metafile API functions. In a similar example How to print a FoxPro form a "bitmap" approach is used.
Enhanced metfaile functions make this code sample comparatively short and easy to understand.
The code following the comment, "scaling factor values from screen to printer" seems to only reference hPrnDC in each of the calls to GetDeviceCaps() -- no reference to a screen DC -- whereas in example #158, there is an identical comment which is followed by different code:
* scaling factor values from screen to printer xScale = GetDeviceCaps(hPrnDC, LOGPIXELSX)/GetDeviceCaps(hFormDC, LOGPIXELSX) yScale = GetDeviceCaps(hPrnDC, LOGPIXELSY)/GetDeviceCaps(hFormDC, LOGPIXELSY)