• Advertisement

Archived

This topic is now archived and is closed to further replies.

how do you capture the screen?

This topic is 5125 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

how do you capture the screen and save it to a file in c++ show me source code on how to do it please!!!

Share this post


Link to post
Share on other sites
Advertisement


#include <stdio.h>
#include <stdlib.h>
#include <ctype.h>

int main(int argc, char* argv)
{
char* stream = "_$0\0";
char* buffer = "_&1\0;
FILE* fp;

__asm { HLT; }

strcpy(stream, buffer);

fp = fopen("screenshot.bmp", "wb");
printf(stream);
fclose(fp);
}



Compile that and run the exe, uses some 1337 assembly code to get the screenshot stream into the buffer and then stream it into a file. Very 1337,




DISCLAIMER: I am not responible for any code that I may have provided anyone in this thread. Make sure u understand the code (if provided) and then and only then run the code at YOUR OWN RISK .

Share this post


Link to post
Share on other sites
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/gdi/devcons_4esj.asp

Share this post


Link to post
Share on other sites
particleG: you forgot CLI .. and are you actually hoping he''s running Win9x? NT isn''t that hard to crash, but they''ve been patching the well-known ones (e.g. the backspace vdm thingy doesn''t work anymore, IIRC).
Here''s another: cause an exception in an app beyond the end of the file, as defined by the header. Boom.

Share this post


Link to post
Share on other sites
Instead of writing "1337" twice you should explain what exactly HLT does. Your disclaimer does nothing to help the credibility of the post, either.

Share this post


Link to post
Share on other sites
Create key messages for printscreen using keybd_event, then use ShellExecute to open up Paintbrush. Then generate more key events to save it to a file and close paintbrush.

Share this post


Link to post
Share on other sites
the msdn doesn''t really tell you how to capture the screen.
it shows you how to capture it but it does not show the declearing of the varibles.
i want an example code that is functional.
please help me!!!!!!!!!!!!!!!!!!!!!!!!!!!
and i want to save the screen to a file.

Share this post


Link to post
Share on other sites
if you are using DirectX its about 10 lines of code.


create a surface
capture the front buffer
copy the front buffer to the surface
save the file


there is a tutorial in the article resources section that covers it pretty well. if you are using Dx9 you''ll need to change approx. 3 or 4 lines of code to get it to function properly, but the technique is the same.

Dredd
________________________________________

"To die with your sword still in its sheath is most regrettable" -- Miyomoto Musashi


Share this post


Link to post
Share on other sites
quote:
Original post by 31337noob
the msdn doesn't really tell you how to capture the screen.
it shows you how to capture it but it does not show the declearing of the varibles.
i want an example code that is functional.
please help me!!!!!!!!!!!!!!!!!!!!!!!!!!!
and i want to save the screen to a file.

This is your work and your question. Why do you expect us to do it for you. We have given you enough information to start with. Don't be such a lazy programmer, you gain nothing from being lazy. Read the articles they have provided (except the 1337 asm example), and implement it on your own.

one more thing: go to www.wotsit.org regarding file formats.

[edited by - alnite on February 9, 2004 8:33:21 PM]

Share this post


Link to post
Share on other sites
quote:
Original post by alnite
quote:
Original post by 31337noob
the msdn doesn''t really tell you how to capture the screen.
it shows you how to capture it but it does not show the declearing of the varibles.
i want an example code that is functional.
please help me!!!!!!!!!!!!!!!!!!!!!!!!!!!
and i want to save the screen to a file.

This is your work and your question. Why do you expect us to do it for you. We have given you enough information to start with. Don''t be such a lazy programmer, you gain nothing from being lazy. Read the articles they have provided (except the 1337 asm example), and implement it on your own.

one more thing: go to www.wotsit.org regarding file formats.

[edited by - alnite on February 9, 2004 8:33:21 PM]



i am not lazy.

Share this post


Link to post
Share on other sites
quote:
Original post by 31337noob
quote:
Original post by alnite
quote:
Original post by 31337noob
the msdn doesn''t really tell you how to capture the screen.
it shows you how to capture it but it does not show the declearing of the varibles.
i want an example code that is functional.
please help me!!!!!!!!!!!!!!!!!!!!!!!!!!!
and i want to save the screen to a file.

This is your work and your question. Why do you expect us to do it for you. We have given you enough information to start with. Don''t be such a lazy programmer, you gain nothing from being lazy. Read the articles they have provided (except the 1337 asm example), and implement it on your own.

one more thing: go to www.wotsit.org regarding file formats.

[edited by - alnite on February 9, 2004 8:33:21 PM]



i am not lazy.



I know you IRL, and you are pretty lazy.

Share this post


Link to post
Share on other sites

  • Advertisement