×
Namespaces

Variants
Actions

如何捕获屏幕

From Nokia Developer Wiki
Jump to: navigation, search
Article Metadata

文章
翻译:
翻译自: Screen capture
hoolee
最后由 hamishwillee 在 14 Feb 2012 编辑
  • 详细描述

屏幕截图的代码

TSize screenSize = CEikonEnv::Static()->ScreenDevice()->SizeInPixels();
TDisplayMode displayMode = CEikonEnv::Static()->ScreenDevice()->DisplayMode();
 
CFbsBitmap*iBitmap = new (ELeave) CFbsBitmap();
User::LeaveIfError(iBitmap->Create(screenSize, displayMode));
 
TInt err = CEikonEnv::Static()->ScreenDevice()->CopyScreenToBitmap(iBitmap);
iBitmap->Save(_L("c:\\system\\apps\\screen.mbm")); // here u can say
// captured image as MBM

将捕获的截图转换为.jpg

TFileName filename;
filename.Copy(_L("c:\\system\\apps\\1.jpg"));
 
CImageEncoder* iencoder = CImageEncoder::FileNewL(
CEikonEnv::Static()->FsSession(),
filename,_L8("image/jpeg"),
CImageEncoder::EOptionAlwaysThread);
 
CleanupStack::PushL(iencoder);
TRequestStatus aStatus = KErrNone;
iencoder->Convert( &aStatus, *iBitmap );
User::WaitForRequest( aStatus );
CleanupStack::PopAndDestroy();
This page was last modified on 14 February 2012, at 08:20.
30 page views in the last 30 days.
×