How to capture screen to bitmap
在内存中创建一个合适大小的CFbsBitmap对象来保存图片
CWsScreenDevice* screenDev = CCoeEnv::Static()->ScreenDevice();
CFbsBitmap* bitmap = new (ELeave) CFbsBitmap;
CleanupStack::PushL( bitmap );
User::LeaveIfError( bitmap->Create( screenDev->SizeInPixels(),
screenDev->DisplayMode() ) );
将屏幕内容放到CFbsBitmap对象中
User::LeaveIfError( screenDev->CopyScreenToBitmap( bitmap ) );
// use bitmap as appropriate, for example save it to file
CleanupStack::PopAndDestroy( bitmap );
保存为本地图片
use CMdaImageBitmapToDescUtility
iJfifFormat->iSettings.iSampleScheme = TMdaJpgSettings::EColor420;
iJfifFormat->iSettings.iQualityFactor = 50;
// jpeg setting
iJpegConverter->CreateL(*iJpegBuffer, iJfifFormat, NULL, NULL);
// after opening conversion itself
iJpegConverter->ConvertL(*iBitmap);
This code links against fbscli.lib and ws32.lib