Archive for February, 2008

Taking a Screen Shot in .NET

Wednesday, February 20th, 2008

:-D

Hello to whoever is reading this. I hope your having a good day.

The other day I was thinking about writing a screen shot program for that windowed operating system. And being the bored semi-productive person that I am; I set out to make it a reality. My next thought(not literally) was .NET must have a built in function for this. :-D Lucky for me they did. The function is CopyFromScreen(int SourceX, int SourceY, int DestX, int DestY, size SquareSize) .

Here is a link to Microsoft’s information about the function.

Sadly my journey to that information took 2 hours. Partly because I didn’t know exactly what I was searching for. I started by looking for “capture screen shot using .NET”. This brought up a lot of links, and some even had solutions. To bad for me that I didn’t like them(lol at saving time).

  • The majority of the solutions suggested using a keyboard event to send a print screen key press to the system. Then copy the contents of the system clipboard into the program. This feels like rapid development to me. Or maybe a quick hack to be fixed later. :-S
  • Another Solution I saw said to do a complicated device initiate and copy function.
  • There apearntly is another way. My coworker informed me of it, but I have forgotten what he said(me - sleep = forgetful).

I mentioned that the first solution seemed too much like a hack. Also if I only want portions of the screen I would have to do image editing and/or other stuff. Seeing as I don’t do much winshield programming let alone .NET I searched until I found the way I thought was proper. At some point in the future I will post my program up on my site, … and … maybe the code.