Click here to Skip to main content
Rate this: bad
good
Please Sign up or sign in to vote.
See more: C++
Hi
I am performing the translation,rotation techniques on line drawn in a c++ program.Also using a graphics package to draw the line
But i cannot take the screen shot of the output that comes on console screen
I tried all possible combinations and also alt+printscreen,but its not working
Plzease help me...
Posted 3-Mar-12 2:35am
Edited 3-Mar-12 3:24am
v2
Comments
Richard MacCutchan at 3-Mar-12 8:27am
   
What does "it's not working" mean? Please provide full details of what your program is trying to do and what results you get. I just tried alt+printscreen on a console program and it worked fine.
SAKryukov at 3-Mar-12 15:21pm
   
Of course. I answered how to do it programmatically, according to a title of the question, please see.
 
If OP's problem is using Alt+PrnScr, that would be off-topic...
--SA
Rate this: bad
good
Please Sign up or sign in to vote.

Solution 1

Print screen Alt+PrnScr always works on console applications. You are doing something wrong; or your OS is broken.
 
Basically, you do it through getimage(int left, int top, int right, int bottom, void *bitmap), please see:
http://www.programmingsimplified.com/c/graphics.h/getimage[^].
 
Additional problem is how to get the extents of the console window. Here you need to use include <windows.h> as well.
 
In particular, you can assume that the screenshot code is being executed or you can get screen shot of all windows on the desktop, or use some other selection criteria. You will need some of the following Windows API functions:
 
http://msdn.microsoft.com/en-us/library/windows/desktop/ms633504%28v=vs.85%29.aspx[^],
http://msdn.microsoft.com/en-us/library/windows/desktop/ms633505%28v=vs.85%29.aspx[^],
http://msdn.microsoft.com/en-us/library/windows/desktop/ms633515%28v=vs.85%29.aspx[^],
http://msdn.microsoft.com/en-us/library/windows/desktop/ms633519%28v=vs.85%29.aspx[^].
 
The last one GetWindowRect ultimately gives you the size/position parameters you need for a call to getimage.
 
—SA
  Permalink  
v3
Comments
johny10151981 at 3-Mar-12 19:41pm
   
its a good answer though, but i guess, windows.h is not an option for op
SAKryukov at 3-Mar-12 19:47pm
   
Thank you, but why not an option?
--SA
johny10151981 at 3-Mar-12 21:24pm
   
cause i can guess he is using tc3.0, just a guess
SAKryukov at 4-Mar-12 4:12am
   
Really? How do you know (I used Borland C++ too many years ago)? What, windows.h is not available because there is no Windows? Anyway, if something is run under Windows and Windows API is not available, what development is possible?
 
Oh, I got it. Probably you mean that Windows only accessible indirectly via WinBGIM which simulates obsolete Borland Program Interface (BGI) and nothing else. That would be sad. Hard to do development with so deeply obsolete stuff.
--SA
johny10151981 at 4-Mar-12 6:38am
   
During my study I used Turbo C++ 3.0, it's console based. i don't recall having windows.h, it have dos.h though.
SAKryukov at 4-Mar-12 13:03pm
   
That I remember. There was a text mode (not exactly console but random access), and BGI; two separate modes. BGI was extremely poor thing.
--SA
Rate this: bad
good
Please Sign up or sign in to vote.

Solution 2

may be you can use getpixel function and create a bitmap and save to disk. it is not that hard.
  Permalink  
Rate this: bad
good
Please Sign up or sign in to vote.

Solution 3

You can use ALT + ENTER from output window of C ++ then you will come out of full screen.
After that you can use "Printscreen" and then paste in mspaint.
 
It will work !!!!!!
  Permalink  

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
0 OriginalGriff 515
1 Maciej Los 349
2 Richard MacCutchan 220
3 BillWoodruff 209
4 Mathew Soji 160
0 OriginalGriff 8,654
1 Sergey Alexandrovich Kryukov 7,407
2 DamithSL 5,639
3 Maciej Los 5,229
4 Manas Bhardwaj 4,986


Advertise | Privacy | Mobile
Web02 | 2.8.1411028.1 | Last Updated 24 Jan 2013
Copyright © CodeProject, 1999-2014
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100