How to capture the screen

T

Tomomichi Amano

I asked how to "capture the screen" and a kind person replyed and told me to
use the code at http://www.c-sharpcorner.com/Code/2003/Dec/ScreenCapture.asp
I tried to use the code, but when I build the code, it says "User32" is not
found, so I can't load the program. Exactly, how can I use this code? (I'm a
beginner)
Also, if there are anyother codes that I can use to capture the screen,
please send it to me.
Thank you in advance.
 
J

Jacob Munk-Stander

Hi, the code is missing a closing brace to end the GDI32 class. Try with the
following (only the } is new, the rest is just to show where in the code it
is):

---

public static extern int SelectObject(int hdc,int hgdiobj);

}

class User32

---

now derive a new Example and use the CaptureScreen as follows:

Example capScreen = new Example();

capScreen.CaptureScreen("c:\\test.bmp", ImageFormat.Bmp);

Hope this helps!
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top