Click here to Skip to main content
15,879,535 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
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
Updated 3-Mar-12 2:24am
v2
Comments
Richard MacCutchan 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.
Sergey Alexandrovich Kryukov 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

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
 
Share this answer
 
v3
Comments
Mohibur Rashid 3-Mar-12 19:41pm    
its a good answer though, but i guess, windows.h is not an option for op
Sergey Alexandrovich Kryukov 3-Mar-12 19:47pm    
Thank you, but why not an option?
--SA
Mohibur Rashid 3-Mar-12 21:24pm    
cause i can guess he is using tc3.0, just a guess
Sergey Alexandrovich Kryukov 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
Mohibur Rashid 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.
may be you can use getpixel function and create a bitmap and save to disk. it is not that hard.
 
Share this answer
 
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 !!!!!!
 
Share this answer
 

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



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900