473,378 Members | 1,420 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,378 software developers and data experts.

Print Screen to picture

21
Is it possible to make a printscreen in scripting and let this printscreen come in a picture on the form?

thanks
Jan 15 '08 #1
8 2708
lotus18
866 512MB
Is it possible to make a printscreen in scripting and let this printscreen come in a picture on the form?

thanks
try to use an API function for that
Jan 16 '08 #2
Bullitt
21
I solved it this way.

SendKeys "{PRTSC}"

followed by

imgPrintScreen.Picture = Clipboard.GetData

With imgPrintScreen the namen of the image on the screen.
Jan 16 '08 #3
Bullitt
21
I was too fast with my post because now I see that SendKeys "{PRTSC}" isn't working. In API I can only find a way to take printscreen of a window, not of the whole screen.
Jan 16 '08 #4
Killer42
8,435 Expert 8TB
This is a standard function performed by screensavers. If you look up how to create a screensaver in VB, you'll find your answer.
Jan 16 '08 #5
QVeen72
1,445 Expert 1GB
Hi,

Declare this API on top of the form :

Expand|Select|Wrap|Line Numbers
  1. Private Declare Sub keybd_event Lib "user32" _
  2.         (ByVal bVk As Byte, ByVal bScan As Byte, _
  3.         ByVal dwFlags As Long, ByVal dwExtraInfo As Long)
  4.  
  5. Private Sub Command1_Click()
  6.     DoEvents
  7.     Clipboard.Clear
  8.     keybd_event vbKeySnapshot, 0, 0, 0
  9.     DoEvents
  10.     keybd_event vbKeySnapshot, 0, &H2, 0
  11.     DoEvents
  12.     Picture1.Picture = Clipboard.GetData(vbCFBitmap)
  13.     DoEvents
  14.     Me.Refresh
  15. End Sub
  16.  
  17.  
Regards
Veena
Jan 16 '08 #6
Bullitt
21
Thanks for the help.

Know I still have 1 small problem. I want to have the print screen without the form, so I hide the form just before I take the print screen, but the script is too fast, is it possible to wait until the form is really closed? I tried with frmblebleble.Visible but it looks like that parameter changes immediately when you do hide.
Jan 16 '08 #7
Bullitt
21
Ok, problem fixed, just 1 DoEvents in between and it worked like I was hoping.
Jan 16 '08 #8
hi bro,

i have a problem with the "vbKeySnapshot".
i am getting an error. where do i declare this??
Nov 4 '08 #9

Sign in to post your reply or Sign up for a free account.

Similar topics

6
by: Mario | last post by:
I could you print jpg or bmp from the printer commands I tried something like ; Printer.picturepaint ("92.bmp") printer.enddoc Doesn't work.. I want to be able to print a logo or a picture...
4
by: C.K | last post by:
Hi, I am doing a calendar program for printing. I have a vb form. The form has a picture and a calendar grid made out of buttons (I don't actually press the buttons, they were just an easy way...
1
by: Jason Huang | last post by:
Hi, I have no problem in printing the C# Windows Form codes. However, when it comes to print the Form, the "Print" button is greyed out and I can't print the form directly from the Visual Studio...
8
by: Lucas | last post by:
I need print a file in binary mode . f = f.open('python.jpg','rb') bytes = f.read() f.close() print(bytes) I can't get any binary code.
1
by: radhikabista | last post by:
my windows application form is divided into 3 split containers or split panels now what is my problem is i need to print the contents of the middle one container even if it is not seen full. but i...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.