请教如何在BCB中使用API函数PrintScreen
1个回答
展开全部
没有这个函数,自己编一个就行了
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;
}
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;
}
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询