Thread: Capture the screen

  1. #1
    Registered User
    Join Date
    Jan 2007
    Posts
    188

    Capture the screen

    Hello!

    Im using a function to capture the screen. It works great on windows and Firefox, etc. But in Counter-Strike, the program still takes as it wasn't in Counter-Strike. I don't understand why. Im using this code: http://www.codeguru.com/csharp/cshar...icle.php/c6139

  2. #2
    Banned master5001's Avatar
    Join Date
    Aug 2001
    Location
    Visalia, CA, USA
    Posts
    3,685
    I am not even going to look at the code. You can't copy a desktop HDC the same way as you would copy a DX or OGL screen buffer. They are two different types of device contexts.

  3. #3
    Registered User
    Join Date
    Jan 2007
    Posts
    188
    So what i need is a Open GL screen buffer? I've just started with C# so im trying to learn.

  4. #4
    Registered User
    Join Date
    Jan 2007
    Posts
    188
    Are there any good tutorials on how to do this? I've searched alot, and i mean ALOT. I've only found others who asks the same question, not the answer. Please help me!

    EDIT:
    Okay, I think i've gotten more close. Although, my pics is black, ingame and outgame. Here's my code;
    Code:
    int pWidth = Screen.GetBounds(new Point(0, 0)).Width;
                int pHeight = Screen.GetBounds(new Point(0, 0)).Height;
                Bitmap b = new Bitmap(pWidth, pHeight, PixelFormat.Format32bppArgb);
                BitmapData bd = b.LockBits(new Rectangle(0, 0, pWidth, pHeight),
                ImageLockMode.WriteOnly, PixelFormat.Format32bppArgb);
                Gl.glReadPixels(0, 0, pWidth, pHeight, Gl.GL_BGRA_EXT, Gl.GL_UNSIGNED_BYTE, bd.Scan0);
                b.UnlockBits(bd);
                b.Save("data/" + textBox1.Text + "/" + DateTime.Now.Minute + DateTime.Now.Second + ".jpg", System.Drawing.Imaging.ImageFormat.Jpeg);
    Last edited by Livijn; 10-30-2008 at 10:30 AM.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Block/Prevent Screen Capture
    By chaitanya619 in forum C++ Programming
    Replies: 3
    Last Post: 04-16-2008, 11:41 AM
  2. Feedback: Functional Specification Wording
    By Ragsdale85 in forum C++ Programming
    Replies: 0
    Last Post: 01-18-2006, 04:56 PM
  3. What is the code to capture the screen?
    By laar in forum C++ Programming
    Replies: 2
    Last Post: 12-15-2005, 07:53 PM
  4. char copy
    By variable in forum C Programming
    Replies: 8
    Last Post: 02-06-2005, 10:18 PM
  5. i am not able to figure ot the starting point of this
    By youngashish in forum C++ Programming
    Replies: 7
    Last Post: 10-07-2004, 02:41 AM