Go Back  Xtreme Visual Basic Talk > Legacy Visual Basic (VB 4/5/6) > General > SCreenshots


Reply
 
Thread Tools Display Modes
  #1  
Old 10-13-2004, 11:01 PM
Quantumfusion Quantumfusion is offline
Centurion
 
Join Date: Oct 2004
Posts: 176
Default SCreenshots


Can anyone tell me how do i take a screenshot of current screen and display it in a picture box. Also how do i save the screenshot. Thanks
Reply With Quote
  #2  
Old 10-13-2004, 11:36 PM
Niv Niv is offline
Newcomer
 
Join Date: Oct 2004
Posts: 23
Default

It depends on what you are using for your graphics but a very easy way to do it is to use these functions.

*******************************************************
Public Declare Function GetDesktopWindow Lib "user32" Alias "GetDesktopWindow" () As Long

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

Public Declare Function ReleaseDC Lib "user32" Alias "ReleaseDC" (ByVal hwnd As Long, ByVal hdc As Long) As Long
*******************************************************


and use BitBlt

the DC you use in the BitBlt function will be the value of
GetDC(GetDesktopWindow)


If I remember correctly this may only show the desktop.. but I'm not sure.. been a while. Anyway, that should put you in the right direction.

Don't forget to ReleaseDC after you use it.

Niv
Reply With Quote
  #3  
Old 10-14-2004, 12:08 AM
iane87 iane87 is offline
Junior Contributor
 
Join Date: Mar 2004
Posts: 224
Default

Use SendKeys ("{PRTSC}") to get the screen on the clipboard then write Clipboard.GetData to a file.
Reply With Quote
  #4  
Old 10-14-2004, 05:23 AM
alt_255's Avatar
alt_255 alt_255 is offline
Contributor
 
Join Date: Jun 2003
Location: Canberra, ACT, Australia
Posts: 489
Default

the BitBlt way is a lot easier and more reliable.

But i will suggest using StretchBlt intead of BitBlt, because you can resize it. And you don't need to use ReleaseDC.
__________________
alt_255
Vires quod Veneratio

To understand recursion, we must first understand recursion
Reply With Quote
Reply


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Forum Jump

Advertisement:





Free Publications
The ASP.NET 2.0 Anthology
101 Essential Tips, Tricks & Hacks - Free 156 Page Preview. Learn the most practical features and best approaches for ASP.NET.
subscribe
Programmers Heaven C# School Book -Free 338 Page eBook
The Programmers Heaven C# School book covers the .NET framework and the C# language.
subscribe
Build Your Own ASP.NET 3.5 Web Site Using C# & VB, 3rd Edition - Free 219 Page Preview!
This comprehensive step-by-step guide will help get your database-driven ASP.NET web site up and running in no time..
subscribe
 
 
-->