Is there any way to take screen capture in .dll?

Login to reply to this topic.
Wed, 2008-04-23 08:00
Joined: 2008-04-23
Forum posts: 4

Hello!

Is there any way to take screen capture of phone screen in .dll, which is not started in application?

Thank you all ready!


Wed, 2008-04-23 09:33
Joined: 2004-11-29
Forum posts: 1155
Re: Is there any way to take screen capture in .dll?

Yes.

I assume you ask because you before have used the CWsScreenDevice from CCoeEnv::Static()->ScreenDevice().

You can also create your own CWsScreenDevice.

First you have to create a RWsSession and connect it to the window server though

(Untested code, just wrote it down from memory:)

RWsSession ws;
if(KErrNone == ws.Connect()) {
 CWsScreenDevice* scrdev = new (ELeave) CWsScreenDevice(ws);
 CleanupStack::PushL(scrdev);
 ///[...]
 scrdev->CopyScreenToBitmap(... );
/// [...]
 CleanupStack::PopAndDestroy();
 ws.Close();
}

or something along those lines....

Wed, 2008-04-23 10:00
Joined: 2008-04-23
Forum posts: 4
Re: Is there any way to take screen capture in .dll?

I have tried that already. Code looked like this:

RWsSession iWs;
CWsScreenDevice* iScreen;

User::LeaveIfError(iWs.Connect());
iScreen=new (ELeave) CWsScreenDevice(iWs);
User::LeaveIfError(iScreen->Construct());
CFbsBitmap* iBmp = new (ELeave) CFbsBitmap;
CleanupStack::PushL( iBmp );
TInt err=iScreen->CopyScreenToBitmap( iBmp ); //Causes panic WSERV 7
User::LeaveIfError(err);
CleanupStack::PopAndDestroy( iBmp )

And it causes panic WSERV 7.

Wed, 2008-04-23 10:09
Joined: 2005-04-13
Forum posts: 120
Re: Is there any way to take screen capture in .dll?

Hi,

a .dll, which is not started in an application?? How a dll can be executed without loading!!!

Probably you are trying a wrong apporach(thought). for your purpose, you can write one exe program, which can listen to the key events (or any other mechanism), and once that criteria is fulfilled, it can take the screen shot of your phone.

Regards,
Jupitar


Jupitar

Wed, 2008-04-23 10:15
Joined: 2008-04-23
Forum posts: 4
Re: Is there any way to take screen capture in .dll?

.dll is started by other .dll.

Wed, 2008-04-23 10:44
Joined: 2003-12-05
Forum posts: 608
Re: Is there any way to take screen capture in .dll?

.dll is started by other .dll.

Which is started by...? Your dll's have to be loaded by an exe or by an app (pre v9). Which one is it? If the exe is a console app or a server, then you need to manually connect to the window server and create the necessary resources for taking the screen capture. If your exe is a GUI application, then just use the screen device class to take the screen capture.

Thu, 2008-04-24 09:26
Joined: 2004-11-29
Forum posts: 1155
Re: Is there any way to take screen capture in .dll?

I assumed he meant the dll is loaded by an exe that doesn't start the application framework, and therefore doesn't have CCoeEnv.

Anyhow, to the original poster:

WSERV 7 means "Invalid bitmap handle" and the reason is you forget to create your bitmap fully.
Its not enough to just call "new" you have to call Create also.

  • Login to reply to this topic.