Hi,
Does anybody know how i can get a screenshot of the screen?
The idea is to draw the view, get a screenshot of it and save it in a bitmap (cfbsbitmap).
Thanks in advance.
Benji.
Hi,
Does anybody know how i can get a screenshot of the screen?
The idea is to draw the view, get a screenshot of it and save it in a bitmap (cfbsbitmap).
Thanks in advance.
Benji.
Benji, do you just need a software to do that or you need to do it programmatically?
I have developed a freeware application to capture screenshot (http://www.antonypranata.com/screenshot/). If you draw to a view, this application should be able to capture your screen.
If you want do it programmatically, check this out, CWsScreenDevice::CopyScreenToBitmap().
Antony
I need to do it programmatically, i have just seen CWsScreenDevice class ant it seems to be perfect for me.
I'll try it.
Thank you very much.
When i try to capture the screen, i get a kern-exec 3.
Do you know what's happening?
Code:
iBitmap = new (ELeave) CFbsBitmap();
CWsScreenDevice* screenDev = new (ELeave) CWsScreenDevice;
if(screenDev != NULL)
screenDev->CopyScreenToBitmap(iBitmap);
Now, i have tried to get the CWsScreenDevice object from GC but i get a WSERV 7 error.
CWindowGc& gc = SystemGc();
iBitmap = new (ELeave) CFbsBitmap();
CWsScreenDevice* screenDev = static_cast<CWsScreenDevice*>(gc.Device());
if(screenDev != NULL)
screenDev->CopyScreenToBitmap(iBitmap);
If you look into SDK Help, WSERV7 means:
You need to create your bitmap before calling CopyScreenToBitmap(). For example, you can do it via CFbsBitmap::Create() function.Invalid bitmap handle.
A corrupt bitmap handle was encountered. This is a common panic uncovered when a bitmap handle refers to nothing, or to a server-side object that isn’t a bitmap.
Antony
With "CopyScreenToBitmap(iBitmap)" in most of 3rd edition devices it's not posible to take a screen capture of a video: you can only take a snapshot of the background. Do You know if ther's other trick to take a snap of the video? I tried to read direct from video memory without luck. Perhaps with direct screen access or with Hardware bitmap but in the SDK the documentation it's incomplete.
I guess this restriction is intentional and it supports DRM protection.
I think you are right. Probably the problem is DRM. So I think that the only way o do that is to write my own pugin for decode video. Anyway I think that is a stupid restriction!
I can get a screenshot, when my applicaiton is in foreground, but if I send the app to the background I cant get the key events in my app. I am using
iKey = iEikonEnv->RootWin().CaptureKey(EStdKeyUpArrow,0,0); // in constructor
and in HandleKeyEventL below code..
if (aEvent.Key()->iScanCode == EStdKeyUpArrow )
{
TakeScreenShotL();
}
Any clues, whats missing/wrong?
I use the CaptureKey too and I get it works.
Somthing like this:
first you register the key
after you can handle the keyCode:EHandleKey = iEikonEnv->RootWin().CaptureKey(EKeyLeftArrow,0,0);
A question about the snapshot: You can get the snapshot beacause you are working on S60 2nd edition, it's right?Code:TKeyResponse C***AppUi::HandleKeyEventL(const TKeyEvent& aKeyEvent,TEventCode aType) if (aType == EEventKey) { switch(aKeyEvent.iCode) { case EKeyLeftArrow: { } } }
I still cant capture key events within my app when it is in background. Any clues what could be wrong?
If you are using a 3rd edition device you need the SwEvent capability to get the capture key event
i am trying capture the screen with same code with symbian 3rd ed. SDk.i getting error like...
Undefined symbol: 'int CWsScreenDevice::CopyScreenToBitmap(class CFbsBitmap const *) const (?CopyScreenToBitmap@CWsScreenDevice@@QBEHPBVCFbsBitmap@@@Z)'
i am newbie plz help.
consider including ws32.lib in the mmp file of the project