Results 1 to 16 of 16

Thread: Screenshots

  1. #1

    Thread Starter
    Addicted Member Fat_N_Furry's Avatar
    Join Date
    Oct 2002
    Posts
    171

    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!

  2. #2
    PowerPoster Lethal's Avatar
    Join Date
    Oct 2000
    Location
    Ohio
    Posts
    2,496
    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.

  3. #3
    PowerPoster Lethal's Avatar
    Join Date
    Oct 2000
    Location
    Ohio
    Posts
    2,496
    If you need me to convert it to vb.net, let me know..

  4. #4

    Thread Starter
    Addicted Member Fat_N_Furry's Avatar
    Join Date
    Oct 2002
    Posts
    171
    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!

  5. #5

    Thread Starter
    Addicted Member Fat_N_Furry's Avatar
    Join Date
    Oct 2002
    Posts
    171
    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!

  6. #6
    PowerPoster Lethal's Avatar
    Join Date
    Oct 2000
    Location
    Ohio
    Posts
    2,496
    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

  7. #7

    Thread Starter
    Addicted Member Fat_N_Furry's Avatar
    Join Date
    Oct 2002
    Posts
    171
    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!

  8. #8
    PowerPoster Lethal's Avatar
    Join Date
    Oct 2000
    Location
    Ohio
    Posts
    2,496
    No prob...

  9. #9

    Thread Starter
    Addicted Member Fat_N_Furry's Avatar
    Join Date
    Oct 2002
    Posts
    171
    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:
    1. Dim OldClipboard = Clipboard.GetDataObject()
    2. 'Take the pictures, put it in their hard drive, etc...
    3. 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!

  10. #10
    PowerPoster Lethal's Avatar
    Join Date
    Oct 2000
    Location
    Ohio
    Posts
    2,496
    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.

  11. #11

    Thread Starter
    Addicted Member Fat_N_Furry's Avatar
    Join Date
    Oct 2002
    Posts
    171
    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!

  12. #12

    Thread Starter
    Addicted Member Fat_N_Furry's Avatar
    Join Date
    Oct 2002
    Posts
    171
    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!

  13. #13
    PowerPoster hellswraith's Avatar
    Join Date
    Jul 2002
    Location
    Washington St.
    Posts
    2,464
    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.

  14. #14

    Thread Starter
    Addicted Member Fat_N_Furry's Avatar
    Join Date
    Oct 2002
    Posts
    171
    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!

  15. #15
    Addicted Member
    Join Date
    Jul 1999
    Posts
    207
    I think this should be about right.

    VB Code:
    1. Try
    2.  
    3.             Dim oldData As Object = Nothing
    4.             Dim iOrgData As IDataObject = Clipboard.GetDataObject()
    5.  
    6.             oldData = CType(iOrgData.GetData(DataFormats.Text), Object)
    7.  
    8.             SendKeys.SendWait("+{PRTSC}")
    9.  
    10.             Dim iData As IDataObject = Clipboard.GetDataObject()
    11.             Dim bSnapShot As Bitmap = CType(iData.GetData(DataFormats.Bitmap), Bitmap)
    12.  
    13.             Me.BackgroundImage = bSnapShot
    14.             bSnapShot.Save("c:\snapshot.bmp", System.Drawing.Imaging.ImageFormat.Bmp)
    15.  
    16.             Clipboard.SetDataObject(oldData, True)
    17.  
    18.         Catch
    19.             MessageBox.Show("Error")
    20.         End Try

    Jeremy

  16. #16

    Thread Starter
    Addicted Member Fat_N_Furry's Avatar
    Join Date
    Oct 2002
    Posts
    171
    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
  •  



Click Here to Expand Forum to Full Width