读书人

请教如何在BCB中使用API函数PrintScre

发布时间: 2012-12-16 12:02:32 作者: rapoo

请问怎么在BCB中使用API函数PrintScreen?
我在BCB中直接使用不行,不知道是不是要加什么声明或者头文件!
[解决办法]
没有这个函数,自己编一个就行了
void __fastcall TForm1::Button1Click(TObject *Sender)
{

Graphics::TBitmap *pbmp = new Graphics::TBitmap;

int width = Screen->Width;
int height = Screen->Height;
pbmp->Width = width;
pbmp->Height = height;

HDC hdc = ::GetDC( ::GetDesktopWindow( ) );

::BitBlt( pbmp->Canvas->Handle,0,0,width,height,hdc,0,0,SRCCOPY );
::ReleaseDC(NULL,hdc);

pbmp->SaveToFile("c:\\screen.bmp");

delete pbmp;





}
//---------------------------------------


[解决办法]
我主要想实现后台抓图的功能,BitBlt不能实现后台抓图!
[解决办法]
我按照调用DLL来方法来用printwindow,可惜只能抓网页和一些其它窗口,但是试了一款游戏就不行,抓出来的图是黑块,但是我看到别人用按键精灵实现了这款游戏的后台抓图.莫非按键精灵用了其它的方法后面抓图,那位高人帮忙指点一下

读书人网 >C++ Builder

热点推荐