Thread: desktop screenshot using C or C++

  1. #1
    Registered User
    Join Date
    Dec 2012
    Location
    Hyderabad, Andhra Pradesh, India
    Posts
    12

    desktop screenshot using C or C++

    I want to know how to write Simple C or C++ program to capture entire desktop image for every 1 min

  2. #2
    C++ Witch laserlight's Avatar
    Join Date
    Oct 2003
    Location
    Singapore
    Posts
    28,413
    Hmm... you ask about how to change keypresses to result in something else, then you ask about desktop screenshots to be taken periodically. What are you up to, really? Don't tell me that it is just knowledge, please.
    Quote Originally Posted by Bjarne Stroustrup (2000-10-14)
    I get maybe two dozen requests for help with some sort of programming or design problem every day. Most have more sense than to send me hundreds of lines of code. If they do, I ask them to find the smallest example that exhibits the problem and send me that. Mostly, they then find the error themselves. "Finding the smallest program that demonstrates the error" is a powerful debugging tool.
    Look up a C++ Reference and learn How To Ask Questions The Smart Way

  3. #3
    Registered User
    Join Date
    Dec 2012
    Location
    Hyderabad, Andhra Pradesh, India
    Posts
    12
    Quote Originally Posted by laserlight View Post
    Hmm... you ask about how to change keypresses to result in something else, then you ask about desktop screenshots to be taken periodically. What are you up to, really? Don't tell me that it is just knowledge, please.

    Actually my intention is to capture desktop. remember in the other thread I asked key 'n' should be pressed when I press 'a' and I want to replace key 'n' with 'PrtScrn' because in my keyboard 'PrtScrn' key is not working.

    So the thread 'change keypresses' is my another idea of desktop capture.

    So please if you can help me, help me.

  4. #4
    C++ Witch laserlight's Avatar
    Join Date
    Oct 2003
    Location
    Singapore
    Posts
    28,413
    Quote Originally Posted by Yaswanth
    I want to replace key 'n' with 'PrtScrn' because in my keyboard 'PrtScrn' key is not working.
    I already gave you AutoIt as a suggestion. Here's another suggestion: change to a working keyboard.

    Maybe I'm just being overly suspicious of a new member, but the "every 1 min" sounds like you are up to no good, and coupled with the fact that you were asking about the keypress thing "for knowledge" when you could have said up front that you wanted to rebind another key to your print screen key because it was not working...
    Quote Originally Posted by Bjarne Stroustrup (2000-10-14)
    I get maybe two dozen requests for help with some sort of programming or design problem every day. Most have more sense than to send me hundreds of lines of code. If they do, I ask them to find the smallest example that exhibits the problem and send me that. Mostly, they then find the error themselves. "Finding the smallest program that demonstrates the error" is a powerful debugging tool.
    Look up a C++ Reference and learn How To Ask Questions The Smart Way

  5. #5
    Registered User
    Join Date
    Dec 2012
    Location
    Hyderabad, Andhra Pradesh, India
    Posts
    12
    Sorry and I am not upto anything. usually I use fraps to capture screenshots and I capture while playing multiplayer games like AC series. so capturing periodical screenshots is good and i can achieve it by using fraps.
    But then I got the idea of writing my own program and curious to see how much I can do.

  6. #6
    Algorithm Dissector iMalc's Avatar
    Join Date
    Dec 2005
    Location
    New Zealand
    Posts
    6,318
    So you really weren't talking about changing the output of a console program then. You're talking about wanting to rewire the keyboard at the driver level. Something that would be sufficient for say a keyboard logger.
    Futhermore, simply pressing the print-screen key doesn't get you a file saved on disk, so I'm guessing that the next thing you'll ask is how to save the image. Something that would be sufficient for a screen logger.
    Lemme guess, you next want to know how to send files across the internet to another computer.

    Yeah I don't think I'm going to be helping you. If this was for legitimate purposes then that's unfortunate. You'll have to find someone a bit more gullible, erm I mean trusting.
    My homepage
    Advice: Take only as directed - If symptoms persist, please see your debugger

    Linus Torvalds: "But it clearly is the only right way. The fact that everybody else does it some other way only means that they are wrong"

  7. #7
    Registered User
    Join Date
    Dec 2012
    Location
    Hyderabad, Andhra Pradesh, India
    Posts
    12
    Quote Originally Posted by iMalc View Post
    So you really weren't talking about changing the output of a console program then. You're talking about wanting to rewire the keyboard at the driver level. Something that would be sufficient for say a keyboard logger.
    Futhermore, simply pressing the print-screen key doesn't get you a file saved on disk, so I'm guessing that the next thing you'll ask is how to save the image. Something that would be sufficient for a screen logger.
    Lemme guess, you next want to know how to send files across the internet to another computer.

    Yeah I don't think I'm going to be helping you. If this was for legitimate purposes then that's unfortunate. You'll have to find someone a bit more gullible, erm I mean trusting.

    Well if you don't want to help that's ok.
    If I want that kind of thing I can easily use the existing tools to do that but not waiting hours and refreshing pages to find the answer that I am waiting for.
    If you don't want to help fine there is no need to post a full size paragraph telling that you don't want to help.

  8. #8
    Lurking whiteflags's Avatar
    Join Date
    Apr 2006
    Location
    United States
    Posts
    9,612
    If I want that kind of thing I can easily use the existing tools to do that but not waiting hours and refreshing pages to find the answer that I am waiting for.
    Someone who wanted to learn would not find this a waste of time. The more you know about types of people, the better a scheme you will plan.

  9. #9
    Stoned Witch Barney McGrew's Avatar
    Join Date
    Oct 2012
    Location
    astaylea
    Posts
    420
    It's not something that can be accomplished with standard C or C++, since they don't have that functionality. How you'll do it depends on your platform as well as the libraries you have installed. I suggest actually learning one of the aforementioned languages before trying to accomplish what you're attempting.

    Alternatively, if you're using a unix-like system, a far simpler option would be to write a script using a language like Bash. What you're asking for is really just a combination of two programs:
    • A program that will delay for 1 minute (like sleep.)
    • A program that will capture a desktop image (like scrot.)

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Screenshot OCR SDK
    By texasnomad in forum C++ Programming
    Replies: 0
    Last Post: 04-06-2011, 08:29 AM
  2. Here is a Screenshot of my GUI for my RPG
    By eaane74 in forum Game Programming
    Replies: 33
    Last Post: 12-16-2007, 10:23 PM
  3. How can I load a screenshot of the desktop into my HBITMAP var?
    By Queatrix in forum Windows Programming
    Replies: 12
    Last Post: 10-09-2005, 02:46 AM
  4. take screenshot
    By MeGaBiTe1 in forum Windows Programming
    Replies: 2
    Last Post: 09-02-2004, 10:33 PM
  5. dvd screenshot
    By ichijoji in forum Tech Board
    Replies: 1
    Last Post: 03-27-2004, 03:07 PM