Hi!
I want to write a code to capture the current screen. How can I do this please?
Thanks.
Printable View
Hi!
I want to write a code to capture the current screen. How can I do this please?
Thanks.
Press Print Screen
Open up your fav paint program.
Edit->Paste as New Image.
As far as code goes...I'm sure it has something to do with the Windows clipboard.
I'm trying the below code, but it's not working. And could anyone please explain the "capture driver index" parameter of capDriverConnect()?
Code:#include "stdafx.h"
#pragma comment(lib, "vfw32")
#include<vfw.h>
int APIENTRY WinMain(HINSTANCE hInstance,
HINSTANCE hPrevInstance,
LPSTR lpCmdLine,
int nCmdShow)
{
HWND hwnd = capCreateCaptureWindow ( "Capture Window",
WS_VISIBLE , 0, 0, 200, 200, NULL, 0);
if(!capDriverConnect (hwnd, 0))
MessageBox(NULL, "error", NULL,0);
if(!capGrabFrameNoStop(hwnd))
MessageBox(NULL, "error", NULL,0);
if(!capFileSaveDIB(hwnd, "cap.bmp"))
MessageBox(NULL, "error", NULL,0);
return 0;
}
Funnily enough I did a little search on this board and look at what I found
Thanks.
After I've got the bitmap in a DC, how can I save it as a bmp file on the disk?
Study the file format
Use WriteFile