-
June 23rd, 2005, 12:25 AM
#1
Screen Snapshot
Hello,
How do I get the screen snapshot, is there an API for that?
Thanks
Avi123
-
June 23rd, 2005, 12:54 AM
#2
-
June 23rd, 2005, 01:09 AM
#3
Re: Screen Snapshot
and how do I save it to a (bmp?) file & open this bmp (programmaticly) by some other application?
Thanks
Avi123
-
June 23rd, 2005, 01:19 AM
#4
Re: Screen Snapshot
Originally Posted by Ejaz
I can't download the source! (Article not found!)
Thanks
Avi123
-
June 23rd, 2005, 01:29 AM
#5
Re: Screen Snapshot
Simulate pressing printscreen key, it will copy screen snapshot to clipboard, latter u can take it from clipboard. For simulating key, use keybd_event() or SendInput() function. and use following key
VK_SNAPSHOT (0x002C -virtual code of print screen)
Life is what u make it and u can make it more simple..........and woderful.
Rate is what give and it give me pleasure.
-
June 23rd, 2005, 01:32 AM
#6
Re: Screen Snapshot
Thats wierd. Anyway, try this one.
Barry's Screen Capture from CodeProject.
-
June 23rd, 2005, 01:52 AM
#7
Re: Screen Snapshot
and how do I save it to a (bmp?) file & open this bmp (programmaticly) by some other application?
use this code:
Code:
void WriteBmp(char* name,int W,int H,int* data)
{
BITMAPINFO Bmi;
memset(&Bmi,0,sizeof(BITMAPINFO));
Bmi.bmiHeader.biSize = sizeof(BITMAPINFOHEADER);
Bmi.bmiHeader.biWidth = W;
Bmi.bmiHeader.biHeight = H;
Bmi.bmiHeader.biPlanes = 1;
Bmi.bmiHeader.biBitCount = 32;
Bmi.bmiHeader.biCompression = BI_RGB;
Bmi.bmiHeader.biSizeImage = W*H*4;
FILE* image = fopen (name,"wb");
if(image==0)
return;
int h = abs(Bmi.bmiHeader.biHeight);
int w = abs(Bmi.bmiHeader.biWidth);
Bmi.bmiHeader.biHeight=h;
Bmi.bmiHeader.biWidth=w;
int sz = Bmi.bmiHeader.biSizeImage;
BITMAPFILEHEADER bfh;
bfh.bfType=('M'<<8)+'B';
bfh.bfOffBits=sizeof(BITMAPFILEHEADER)+sizeof(BITMAPINFOHEADER);
bfh.bfSize=sz+bfh.bfOffBits;
bfh.bfReserved1=0;
bfh.bfReserved2=0;
fwrite(&bfh,sizeof(bfh),1,image);
fwrite(&Bmi.bmiHeader,sizeof(BITMAPINFOHEADER),1,image);
fwrite(data,sz,1,image);
fclose(image);
}
if i helped dont forget to rate :-)
Cheers
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|