Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
CreateCompatibleBitMap and Win2000
Message
From
20/12/2001 03:52:03
 
 
To
19/12/2001 23:11:35
Calvin Smith
Wayne Reaves Computer Systems
Macon, Georgia, United States
General information
Forum:
Visual FoxPro
Category:
Windows API functions
Miscellaneous
Thread ID:
00596108
Message ID:
00596593
Views:
22
>George,
>Did I mention that this was copied from a posting on new2news? I don't actually understand in any detail this code. I hope this is the part that you are interested in (thanks):
>
>hFormDC = GetWindowDC(hwnd)
> = getWinRect (hwnd, @pnWidth, @pnHeight)
>
> * scaling factor values from screen to printer
> xScale = GetDeviceCaps(hPrnDC, LOGPIXELSX)/GetDeviceCaps(hFormDC, LOGPIXELSX)
> yScale = GetDeviceCaps(hPrnDC, LOGPIXELSY)/GetDeviceCaps(hFormDC, LOGPIXELSY)
>
> * creating screen compatible DC and BITMAP to pass image
> * through them from screen to printer; no direct screen to printer copying
> hMemDC = CreateCompatibleDC (hFormDC)
> hMemBmp = CreateCompatibleBitmap (hFormDC, pnWidth, pnHeight)
> hSavedBitmap = SelectObject(hMemDC, hMemBmp)
>
> * copying bitmap data from screen to virtual device context
> * and unselecting the bmp from the memory device context
> = BitBlt (hMemDC, 0,0, pnWidth,pnHeight, hFormDC, 0,0, SRCCOPY)
> = SelectObject(hMemDC, hSavedBitmap)
>
> * retrieving bits from the compatible bitmap into a buffer
> * as a device-independent bitmap (DIB) with a BitsPerPixel value
> * as one of the printer device context
> lcBInfo = InitBitmapInfo(hPrnDC)
> lpBitsArray = InitBitsArray()
> = GetDIBits (hMemDC, hMemBmp, 0, pnHeight,;
> lpBitsArray, @lcBInfo, DIB_RGB_COLORS)
>
> lcDocInfo = Chr(20) + Repli(Chr(0), 19) && DOCINFO struct - 20 bytes
> IF StartDoc(hPrnDC, @lcDocInfo) > 0
> = StartPage(hPrnDC)
>
> = StretchDIBits (hPrnDC, xOffsPrn, yOffsPrn,;
> xOffsPrn + Int(xScale * pnWidth),;
> yOffsPrn + Int(yScale * pnHeight),;
> 0,0, pnWidth, pnHeight,;
> lpBitsArray, @lcBInfo, DIB_RGB_COLORS, SRCCOPY)
>
> = EndPage(hPrnDC)
> = EndDoc(hPrnDC)
> ENDIF

As I said, the problem you see arises from the use of SelectObject() and BitBlt().
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