|
-
Nov 5th, 2002, 01:48 PM
#1
Thread Starter
Addicted Member
Screenshots
Hey is there any way to take a screenshot of whatever the user sees, and then send it to a location on the hard drive without him/her seeing it being done? I also want to include the mouse in the picture.
What I'm trying to do is create a program for movie creation (like if I wanted to create a movie to show someone, over the internet, how to do something on the computer).
Thanks in advance,
Furry
 Eat long and prosper! 
If someone helps you, find someone you can help.
If you still have time, click on the darn banner up there and help the forum! 
-
Nov 5th, 2002, 08:34 PM
#2
PowerPoster
Sure..
Code:
private void btnSnapShop_Click(object sender, System.EventArgs e)
{
SendKeys.SendWait("+{PRTSC}"); // take a snapshot of the client's desktop
IDataObject iData = Clipboard.GetDataObject();
Bitmap bSnapShot = (Bitmap)iData.GetData(DataFormats.Bitmap);
this.BackgroundImage = bSnapShot;
bSnapShot.Save(@"c:\snapshot.bmp",System.Drawing.Imaging.ImageFormat.Bmp);
}
Last edited by Lethal; Nov 5th, 2002 at 08:44 PM.
-
Nov 5th, 2002, 08:45 PM
#3
PowerPoster
If you need me to convert it to vb.net, let me know..
-
Nov 5th, 2002, 09:06 PM
#4
Thread Starter
Addicted Member
Yes - I will need you to do that please. I'm a complete newbie in .NET.
Gracias Muy Mucho!
Furry
 Eat long and prosper! 
If someone helps you, find someone you can help.
If you still have time, click on the darn banner up there and help the forum! 
-
Nov 5th, 2002, 09:15 PM
#5
Thread Starter
Addicted Member
Oh - I forgot to ask you - how do you keep it from being shown in the task manager?
Thanks again!
 Eat long and prosper! 
If someone helps you, find someone you can help.
If you still have time, click on the darn banner up there and help the forum! 
-
Nov 5th, 2002, 09:42 PM
#6
PowerPoster
Here you go...
Code:
Imports System.IO
Private Sub btnSnapShot_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnSnapShot.Click
SendKeys.SendWait("+{PRTSC}")
Dim iData As IDataObject = Clipboard.GetDataObject()
Dim bSnapShot As Bitmap = CType(iData.GetData(DataFormats.Bitmap), Bitmap)
Me.BackgroundImage = bSnapShot
bSnapShot.Save("c:\snapshot.bmp", System.Drawing.Imaging.ImageFormat.Bmp)
End Sub
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
Me.ShowInTaskbar = False
End Sub
-
Nov 5th, 2002, 09:49 PM
#7
Thread Starter
Addicted Member
OMG that is sweetness. Thankyou so much, Lethal!
 Eat long and prosper! 
If someone helps you, find someone you can help.
If you still have time, click on the darn banner up there and help the forum! 
-
Nov 5th, 2002, 10:01 PM
#8
-
Nov 5th, 2002, 11:10 PM
#9
Thread Starter
Addicted Member
Crap now I can't get around this user inconvenience - if they use the program, their clipboard data will be lost. :/ This is the code I'm trying to use, but it doesn't work:
VB Code:
Dim OldClipboard = Clipboard.GetDataObject()
'Take the pictures, put it in their hard drive, etc...
Clipboard.SetDataObject(OldClipboard)
Thanks again for your help.
 Eat long and prosper! 
If someone helps you, find someone you can help.
If you still have time, click on the darn banner up there and help the forum! 
-
Nov 5th, 2002, 11:29 PM
#10
PowerPoster
try this:
Code:
private void btnSnapShop_Click(object sender, System.EventArgs e)
{
try
{
object oldData = null;
IDataObject iOrgData = Clipboard.GetDataObject();
if(iOrgData != null)
{
oldData = (object)iOrgData.GetData(DataFormats.Text);
}
SendKeys.SendWait("+{PRTSC}"); // take a snapshot of the client's desktop
IDataObject iData = Clipboard.GetDataObject();
Bitmap bSnapShot = (Bitmap)iData.GetData(DataFormats.Bitmap);
this.BackgroundImage = bSnapShot;
bSnapShot.Save(@"c:\snapshot.bmp",System.Drawing.Imaging.ImageFormat.Bmp);
if(oldData !=null)
{
Clipboard.SetDataObject(oldData, true);
}
}
catch
{
MessageBox.Show("Error");
}
}
Last edited by Lethal; Nov 5th, 2002 at 11:36 PM.
-
Nov 5th, 2002, 11:36 PM
#11
Thread Starter
Addicted Member
Um - that doesn't look like VB - is it?
 Eat long and prosper! 
If someone helps you, find someone you can help.
If you still have time, click on the darn banner up there and help the forum! 
-
Nov 7th, 2002, 07:04 PM
#12
Thread Starter
Addicted Member
Yo! Dude! You there? Could you translate this to VB.NET for me please?
Thanks
 Eat long and prosper! 
If someone helps you, find someone you can help.
If you still have time, click on the darn banner up there and help the forum! 
-
Nov 7th, 2002, 08:03 PM
#13
PowerPoster
It is in C#. Just look at the code, and convert it. The only things you have to convert are the if statements, the declaring objects statements, and take off the ';'s at the ends of the lines.
-
Nov 7th, 2002, 10:02 PM
#14
Thread Starter
Addicted Member
But I don't know any C#. I wouldn't know If statement from a declaration, if it weren't for the 'If' at the beginning of them. Telling me to translate C# to VB.NET is like picking some random guy off the street and telling him to make a replica of Microsoft Word. I don't even know most of the stuff he posted in VB.NET. I was planning on looking everything up in MSDN after this bit of code is done. I apologize for my complete ignorance.
 Eat long and prosper! 
If someone helps you, find someone you can help.
If you still have time, click on the darn banner up there and help the forum! 
-
Nov 7th, 2002, 10:20 PM
#15
Addicted Member
I think this should be about right.
VB Code:
Try
Dim oldData As Object = Nothing
Dim iOrgData As IDataObject = Clipboard.GetDataObject()
oldData = CType(iOrgData.GetData(DataFormats.Text), Object)
SendKeys.SendWait("+{PRTSC}")
Dim iData As IDataObject = Clipboard.GetDataObject()
Dim bSnapShot As Bitmap = CType(iData.GetData(DataFormats.Bitmap), Bitmap)
Me.BackgroundImage = bSnapShot
bSnapShot.Save("c:\snapshot.bmp", System.Drawing.Imaging.ImageFormat.Bmp)
Clipboard.SetDataObject(oldData, True)
Catch
MessageBox.Show("Error")
End Try
Jeremy
-
Nov 7th, 2002, 10:32 PM
#16
Thread Starter
Addicted Member
Thanks, dudes. Much appreciated, all of you. 
Bug ya later! 
Furry
 Eat long and prosper! 
If someone helps you, find someone you can help.
If you still have time, click on the darn banner up there and help the forum! 
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|