PDA

Click to See Complete Forum and Search --> : Capturing the screen


death
Jan 5th, 2000, 06:51 PM
I have the code to capture the screen and place it as the background of a form but...
The compiled program I downloaded works
the source code that I downloaded with it does not compile. It gives an error when it hits the part of a line
screen.width and screen.height
I know these exist as they are in the F2 list.
what is the problem with the code.

Dim DeskhWnd As Long, DeskDC As Long
DeskhWnd& = GetDesktopWindow()
DeskDC& = GetDC(DeskhWnd&)
BitBlt Client.hDC, 0&, 0&, 800, 600, DeskDC&, 0&, 0&, SRCCOPY
DoEvents

Thanks

Mark Sreeves
Jan 5th, 2000, 07:25 PM
if you change the intergers for long in the declare statement it works ok.

------------------
Mark Sreeves
Analyst Programmer

Mark.Sreeves@Softlab.co.uk
A BMW Group Company

death
Jan 5th, 2000, 07:36 PM
Nope sorry it still doesn't work the compile error is
Method or data member not found.
when it hits the screen.width and screen.height
Thanks for any more help

Mark Sreeves
Jan 5th, 2000, 08:04 PM
What is client in your code?

this works fine for me (in a form)

Option Explicit

Private Declare Function BitBlt Lib "gdi32" _
(ByVal hDestDC As Long, ByVal x As Long, _
ByVal y As Long, ByVal nWidth As Long, _
ByVal nHeight As Long, ByVal _
hSrcDC As Long, ByVal xSrc As Long, _
ByVal ySrc As Long, ByVal dwRop As _
Long) As Long

Private Declare Function GetDesktopWindow Lib "user32" () As Long
Private Declare Function GetDC Lib "user32" _
(ByVal hwnd As Long) As Long

Const SRCCOPY = &HCC0020
Const SRCAND = &H8800C6
Const SRCINVERT = &H660046


Private Sub Command1_Click()
Unload Me
End Sub

Private Sub Form_Load()
Dim DeskhWnd As Long, DeskDC As Long
DeskhWnd& = GetDesktopWindow()
DeskDC& = GetDC(DeskhWnd&)
BitBlt Form1.hDC, 0&, 0&, _
Screen.Width, Screen.Height, DeskDC&, _
0&, 0&, SRCCOPY
End Sub

death
Jan 6th, 2000, 02:53 AM
Client is the name of the form
ie client instead of form1
I don't know what the problem is but when I go onto the F2 thing I have two versions of screen one with about five commands after the dot
and the one I want but can't use with about 20
I don't know why this is
I'm going to give it a try in VB5
see if that works
Thanks for your help