Results 1 to 5 of 5

Thread: Capturing the screen

  1. #1

    Thread Starter
    Lively Member
    Join Date
    Oct 1999
    Posts
    67

    Post

    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

  2. #2
    Frenzied Member Mark Sreeves's Avatar
    Join Date
    Nov 1999
    Location
    UK
    Posts
    1,845

    Post

    if you change the intergers for long in the declare statement it works ok.

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

    [email protected]
    A BMW Group Company

  3. #3

    Thread Starter
    Lively Member
    Join Date
    Oct 1999
    Posts
    67

    Post

    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

  4. #4
    Frenzied Member Mark Sreeves's Avatar
    Join Date
    Nov 1999
    Location
    UK
    Posts
    1,845

    Post

    What is client in your code?

    this works fine for me (in a form)
    Code:
    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

  5. #5

    Thread Starter
    Lively Member
    Join Date
    Oct 1999
    Posts
    67

    Post

    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

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width