Thread: program to take screenshot using C

  1. #1
    Registered User
    Join Date
    Aug 2007
    Posts
    9

    program to take screenshot using C

    hi there
    i am new to this forum and a noob in c programming.
    I am trying to create a program in c which takes screenshots for me and shows it to me.
    Please can someone help me out here?
    any help will be appreciated
    thanx!!

  2. #2
    Kernel hacker
    Join Date
    Jul 2007
    Location
    Farncombe, Surrey, England
    Posts
    15,677
    I'm pretty sure that there are PLENTY of source code available for this type of application on the net. Of course, it would make a big difference which OS you are using...

    If you want someone to explain to you how such a think works and how to write one yourself from scratch, then you'd have to tell us a bit more about what your experience in programming is. Doing Windows/X-WIndows programming is not for the pure beginner, just like it's better to start with a go-cart if you want to start racing cars, rather than a formula one... Once you know a bit about what you're doing, then you can start working on graphical user interfaces if you like.

    --
    Mats

  3. #3
    Deathray Engineer MacGyver's Avatar
    Join Date
    Mar 2007
    Posts
    3,210
    Depends on the O/S.

    It's like asking, "Where's the shifting stick on a car?" Depends on the car.

    Try to be clearer in your questions in the future.

  4. #4
    Registered User
    Join Date
    Aug 2007
    Posts
    9
    Ok ..
    I want to take screenshots in winxp through C programming.
    Are there any winapi functions available which can help me out.
    thanx for ur support an help

  5. #5
    Kernel hacker
    Join Date
    Jul 2007
    Location
    Farncombe, Surrey, England
    Posts
    15,677
    There isn't a single Win32 API function that will take a screenshot, no. There are several ways to write an application that copies the content of the screen, but it requires a sequence of not entirely trivial calls to the Windows API. If you haven't written any code for Windows applications, it's probably not a decent starter project.

    Obviously, part of this also depends on what else you are going to do once you've copied the screen - save it as a image on disk, copy it to the clipboard, or whatever else you may want to do...

    --
    Mats

  6. #6
    Woof, woof! zacs7's Avatar
    Join Date
    Mar 2007
    Location
    Australia
    Posts
    3,459
    The easiest way - and not the best, is to simulate a "Print Screen" press and copy the contents of the clipboard and dump it to disk, easy but cruddy. For example if the Print Screen Key wasn't bound to take a screenshot, or a program overwrote the clipboard while you were in the middle of getting a screenshot.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Need help with a program, theres something in it for you
    By engstudent363 in forum C Programming
    Replies: 1
    Last Post: 02-29-2008, 01:41 PM
  2. Replies: 4
    Last Post: 02-21-2008, 10:39 AM
  3. Replies: 3
    Last Post: 03-04-2005, 02:46 PM
  4. My program, anyhelp
    By @licomb in forum C Programming
    Replies: 14
    Last Post: 08-14-2001, 10:04 PM