Capturing screen to in-memory bitmap is extremely easy. All you need is to create a bitmap instance with appropriate size
截圖到一個記憶體裡面的點陣圖非常的監督,你只需要創建一個適當大小的點陣圖實例。
CWsScreenDevice* screenDev = CCoeEnv::Static()->ScreenDevice();
CFbsBitmap* bitmap = new (ELeave) CFbsBitmap;
CleanupStack::PushL( bitmap );
User::LeaveIfError( bitmap->Create( screenDev->SizeInPixels(), screenDev->DisplayMode() ) );
and then copy screen content into it as follows
然後像下麵這樣,將螢幕內容拷貝到它裡面。

 

User::LeaveIfError( screenDev->CopyScreenToBitmap( bitmap ) );// use bitmap as appropriate, for example save it to file
CleanupStack::PopAndDestroy( bitmap );
This code links against fbscli.lib and ws32.lib
這些代碼需要連結fbscli.libws32.lib 兩個庫。
 
創作者介紹
創作者 shadow 的頭像
shadow

資訊園

shadow 發表在 痞客邦 留言(0) 人氣()