Click to See Complete Forum and Search --> : How can I copy the screen in the printer objekt?


Martin_G
November 27th, 1999, 12:00 PM
This is my code.

Function PrintScreen()

Dim r As Long
Dim hWndDesk As Long
Dim hDCDesk As Long

Dim LeftDesk As Long
Dim TopDesk As Long
Dim WidthDesk As Long
Dim HeightDesk As Long

'define the screen coordinates (upper
'corner (0,0) and lower corner (Width, Height)
LeftDesk = 0
TopDesk = 0
WidthDesk = Screen.Width \ Screen.TwipsPerPixelX
HeightDesk = Screen.Height \ Screen.TwipsPerPixelY

'get the desktop handle and display context
hWndDesk = GetDesktopWindow()
hDCDesk = GetWindowDC(hWndDesk)

'copy the desktop to the picture box

r = BitBlt(frm40_druck!Picture1.hdc, 0, 0, _
WidthDesk, HeightDesk, hDCDesk, _
LeftDesk, TopDesk, vbSrcCopy)
r = ReleaseDC(hWndDesk, hDCDesk)


'Now I want to copy this to in the printer objekt 'but it doesn't work? How could it work?

'Printer.PaintPicture _
frm40_druck!Picture1.Picture, 0, 0, _
WidthDesk, HeightDesk, hDCDesk, _
LeftDesk, TopDesk, vbSrcCopy
'Printer.EndDoc
End Function

Student