• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 532
  • Last Modified:

Take Screenshot in C

Hey Guys,
Just a question.

I am about to start a new project where I hope to develop a program which will screenshot games as you play, and upload the image to a webserver.
Firstly - I need to know if C would be the best language to use?

How easy is it for C to take a screenshot and resize/convert it to a 600*480 JPG??
How easy is it to open a HTTP connection?
I can make a PHP script to accept a file upload - I just need to know how easy it is to actually upload the file...

I haven't done much on this level with C...

This question will probably end up with points being split.
So PLEASE even if someone has posted something GREAT.
Post too!
I will award anything useful!

Thanks people!

(btw, google is so hard, when searching for example "c" code. type: screenshot + c in goolge and you get 50,000 results that don't help)
  • 9
  • 6
1 Solution
Kent OlsenData Warehouse Architect / DBACommented:
Hi neester,

There are libraries available that can do this.

If you're into C++, that's probably a cleaner solution.

neesterAuthor Commented:
I would love to try it!

Any example code would be lovely!
At the moment, I use Pelles C and GCC to code.
What is a good program for C++??

I have MS Visual C++
From Vis Studio 6...
>How easy is it for C to take a screenshot and resize/convert it to a 600*480 JPG??
Not very sure about taking a screen shot ... you can take a look at ijg jpeg library for conversion part though ... I think ijg library has the conversion facility

>How easy is it to open a HTTP connection?
>I can make a PHP script to accept a file upload - I just need to know how easy it is to actually upload the file..
this should not be too difficult ... google for libcurl
Ultimate Tool Kit for Technology Solution Provider

Broken down into practical pointers and step-by-step instructions, the IT Service Excellence Tool Kit delivers expert advice for technology solution providers. Get your free copy now.

neesterAuthor Commented:
Ahh curl,
Will that work on Windows.

I have used it with Perl and PHP before.
Never with C.
Like I said, I am pretty new to C here :S

I just want something thats ultra efficent.
It just needs to take a screenshot.
Slowly resize and compress the image - low cpu usage if possible,
then upload.

Needs to work on Windows.
neesterAuthor Commented:
Yeah sunny i went there


looks good!

BUT, where do i actually download it?
I found install instructions, but no download links?
Looks great though!
Definatly worth some points!!!

Now how do I take screenshots?
neesterAuthor Commented:
ahh found it!
neesterAuthor Commented:
Ok I downloade CURL, it is an exe, not a normal .h header file.

See this: http://curl.haxx.se/lxr/source/docs/examples/simple.c

How do I compile that?
I am using Pelles C...
If you downloaded source, compiling and installation instructions should be a part of it. Look for a file named README.txt or something similar.

I am not sure how you can take a screen shot from a program ... there are several tools to do this ... Also, for windows Ctrl+Print Scrn and Alt+Print Scrn work ... Dont know if windows provides some useful APIs for the same.
neesterAuthor Commented:
Ahh ok thanx sunny!

Maybe i should try C++??
I am a bit irritated with C's lack of string handling.
Makes life "seemingly unnecessaryly hard"...

Thanks for your input so far:)

Appreciate it very much!
I will concede that C is not the best tool for this job ... C is better suited for system software, OS programming and other things where you need the control and flexibility that C offers.
neesterAuthor Commented:
So your recommendation would be C++??
Thanks very much sunny!
probably saved me a lot of time and bother :D
I am not much experienced with what you are trying ... C++ would be a better fit than C for sure, but I cannot assure you if it is the best choice ... you need to ask that to C++ people or guys who have worked on such problems ...
neesterAuthor Commented:
Thanks a lot sunny!
It answered my questions!

Another question.
I will accept your answer.
Are there many people who help in the C section?
I havent noticed many???

There are many good experts in C section ... But all of them are not around all the time ... Also, as compared to some other TAs we are lot more friendly here ... We show each other mutual respect ... If one expert is handling the question satisfactorily, chances are no other expert is going to jump in with same/similar advise in hunt for points ... We are competitive but in a healthy collaborative way.
neesterAuthor Commented:
Ahh ok :)
Sounds nice :D

WebDev section can get a bit cutthroat at times :)

Thanks again!
I will ask around the C++ section!
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Creating Active Directory Users from a Text File

If your organization has a need to mass-create AD user accounts, watch this video to see how its done without the need for scripting or other unnecessary complexities.

  • 9
  • 6
Tackle projects and never again get stuck behind a technical roadblock.
Join Now