Results 1 to 6 of 6

Thread: Desktop

  1. #1

    Thread Starter
    Lively Member
    Join Date
    Oct 1999
    Posts
    67

    Post

    How do I capture the desktop in VB6
    Once I have captured it how do I send it over a network?
    Thanks Anyone

  2. #2
    Member
    Join Date
    Apr 1999
    Posts
    36

    Post

    capture?

  3. #3
    Hyperactive Member
    Join Date
    Sep 1999
    Posts
    305

    Post

    you mean like print screen and send the bitmap over the network or the actual links and background and all that?

  4. #4
    Lively Member
    Join Date
    May 1999
    Location
    Singapore
    Posts
    116

  5. #5
    Lively Member
    Join Date
    Jun 1999
    Location
    Ireland
    Posts
    96

    Post

    Firstly you must get the hDC of the Desktop by using the following functions.

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

    Then to capture the Desktop, use BitBlt

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

    Usage:
    Create a New Project
    Paste in the 3 Declartions (Private if in Form Level Code)
    Add 1 Picture Box

    Add the following Sub

    Private Sub Form_Load()
    Dim DeskhWnd As Long, DeskDC As Long
    'Get the hWnd of the desktop
    DeskhWnd& = GetDesktopWindow()
    'Get the hDC of the desktop
    DeskDC& = GetDC(DeskhWnd&)
    BitBlt Picture1.hDC, 0&, 0&, Screen.Width, Screen.Height, DeskDC&, 0&, 0&, SRCCOPY
    End Sub

    That's it, you should now have the Desktop copied into the PictureBox.

    Hope this helps,

    Steve.

  6. #6

    Thread Starter
    Lively Member
    Join Date
    Oct 1999
    Posts
    67

    Post

    Yes Capture
    No like print screen
    Thanks for the link
    Thanks for the code
    Thanks to all for your interest

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