Results 1 to 8 of 8

Thread: A simple "print-screen" type Q

  1. #1
    sql_lall
    Guest

    Question A simple "print-screen" type Q

    1) What code do you use to get the background or current picture from the screen (including icons and programs running, like pressing "print screen")? Like those weird screensavers which copy what's on the screen then jumble it about.

    Oh, and 2) what code can you use to find the current dimensions of the screen (e.g. 680 x 800 etc.)??



    Any help will be appreciated

  2. #2
    Good Ol' Platypus Sastraxi's Avatar
    Join Date
    Jan 2000
    Location
    Ontario, Canada
    Posts
    5,134
    2)
    VB Code:
    1. W = Screen.Width / Screen.TwipsPerPixelX
    2. H = Screen.Height / Screen.TwipsPerPixelY
    1)
    VB Code:
    1. Private Declare Function GetDesktopWindow Lib "user32" () As Long
    2. Private Declare Function GetDC Lib "user32" (ByVal hwnd As Long) As Long
    3. Function ScreenCapture() As Long
    4.     ScreenCapture = GetDC(GetDesktopWindow)
    5. End Function
    If you don't understand something, just tell me.
    All contents of the above post that aren't somebody elses are mine, not the property of some media corporation.
    (Just a heads-up)

  3. #3
    sql_lall
    Guest
    Thanks a lot, i understand it

  4. #4
    sql_lall
    Guest

    Sorry,

    Yeah, i just though:
    Is it then possible to change screen size by changing the Screen.Width and .height variables?

  5. #5
    Fanatic Member PsychoMark's Avatar
    Join Date
    Feb 2001
    Location
    Netherlands
    Posts
    540
    Nope, you have to use the ChangeDisplaySettings API...
    Teaudirenopossum.Musasapientumfixaestinaure.
    (I can't hear you. There's a banana in my ear)

  6. #6
    Addicted Member
    Join Date
    Sep 2001
    Location
    Indiana,PA,USA
    Posts
    217
    Hey SasTraxi...


    Can you explain me what it is doing and how to test it?

    When I tested this I am getting some values for that function.
    8126
    1918
    17666
    1914
    1906

    And they are repeating when I keep pressing Command1.

    Regards.
    Sudha

  7. #7
    sql_lall
    Guest
    Now, how do you use that with:
    picture1.picture = (Background)??
    I tried but me and my low intellect failed.

  8. #8
    Good Ol' Platypus Sastraxi's Avatar
    Join Date
    Jan 2000
    Location
    Ontario, Canada
    Posts
    5,134
    Whoops! Left out a doosey- BitBlt. That number is just the location of the desktop graphic - you need to retrieve it.

    Declare the API BitBlt:
    VB Code:
    1. Function ScreenCapture(Pic As PictureBox) As Long
    2.     ScreenCapture = GetDC(GetDesktopWindow)
    3.     BitBlt Pic.hDC, 0, 0, Screen.Width / Screen.TwipsPerPixelX, Screen.Height / Screen.TwipsPerPixelY, ScreenCapture, 0, 0, vbSrcCopy
    4. End Function
    If you want to know more of BitBlt (it's very powerful!) you can see my tutorial on it...

    http://vbden.tripod.com/articles/invmask.htm
    All contents of the above post that aren't somebody elses are mine, not the property of some media corporation.
    (Just a heads-up)

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