×

Discussion Board

Results 1 to 9 of 9
  1. #1
    Regular Contributor
    Join Date
    Jul 2005
    Posts
    95

    CopyScreenToBitmap() problem

    Hi !

    I have this application where I am trying to copy the screen to a bitmap. The code is as follows :

    Code:
    void CAppInBackgroundContainer::CaptureScreen()
    {
        
        
        CWsScreenDevice* iDeviceScreen;     
        RWsSession iWs; 
        
        
        
        User::LeaveIfError(iWs.Connect()); 
        
    
        
        iDeviceScreen = new (ELeave) CWsScreenDevice(iWs); 
        
        
        User::LeaveIfError(iDeviceScreen->Construct()); 
        
        
        CCoeEnv::Static()->ScreenDevice()->CopyScreenToBitmap(iBitmap);
        
    
    }// End of Capture Screen
    The above function gets called when EKeyRightArrow is pressed and this is handled in OfferKeyEventL() . However , pressing the right arraow key is raising a panic. Could you please tell me why this is happening ?

    Thank you :-)

  2. #2
    Nokia Developer Moderator
    Join Date
    Mar 2003
    Location
    Lempäälä/Finland
    Posts
    29,144

    Re: CopyScreenToBitmap() problem

    it would make it easier to figure the problem if you could tell, what is the error message shown ?

    Anyway, why can not use CEikonEnv::Static()->ScreenDevice() for capturing the image ?

    yucca

  3. #3
    Regular Contributor
    Join Date
    Oct 2004
    Location
    india
    Posts
    306

    Re: CopyScreenToBitmap() problem

    use this code to capture screen

    void CHelloWorldAppView::ScreenCapture()
    {



    TSize screenSize = CEikonEnv::Static()->ScreenDevice()->SizeInPixels();
    TDisplayMode displayMode = CEikonEnv::Static()->ScreenDevice()->DisplayMode();

    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"));

    }

  4. #4
    Regular Contributor
    Join Date
    Jul 2005
    Posts
    95

    Re: CopyScreenToBitmap() problem

    Thanks a lot gir...that worked !!!
    Now this question might appear stupid to you but please consider the question as Im a symbian newbie .
    The program has created a .mbm file in C:\Symbian\7.0s\Series60_v21\Epoc32\wins\c\system\Apps by the name screen.mbm.
    Now how can I see the actual picture of the screen thats been captured using this .mbm file that was created ?

    Thank you :-)

  5. #5
    Nokia Developer Moderator
    Join Date
    Mar 2003
    Location
    Lempäälä/Finland
    Posts
    29,144

    Re: CopyScreenToBitmap() problem

    you could construct CFbsBitmap object and load it to it. in case you want to use the image somewhere else, you should save it in other formats such as jpg, or bmp. check SDK examles & documents for more information.

    yucca

  6. #6
    Regular Contributor
    Join Date
    Oct 2004
    Location
    india
    Posts
    306

    Re: CopyScreenToBitmap() problem

    use this code to capture screen


    to make appear on screen
    void CHelloWorldAppView::ScreenCapture()
    {



    TSize screenSize = CEikonEnv::Static()->ScreenDevice()->SizeInPixels();
    TDisplayMode displayMode = CEikonEnv::Static()->ScreenDevice()->DisplayMode();

    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"));
    ///////////////************************************
    imgOK =ETrue;
    DrawNow();
    }[/QUOTE]


    void CHelloWorldAppView:raw(const TRect& /*aRect*/) const
    {
    // Get the standard graphics context
    CWindowGc& gc = SystemGc();
    if(imgOK)
    {
    gc.BitBlt(TPoint(0,0),iBitmap);
    }

    }

  7. #7
    Regular Contributor
    Join Date
    Jul 2005
    Posts
    95

    Re: CopyScreenToBitmap() problem

    Thanks a lot , gir...for ur invaluable help . I was able to extract the bmp from the mbm file using
    Code:
    bmconv /u screen.mbm screen.bmp
    on the PC and that verifies that the screen has been captured successfully.
    However Im in the process of making a Screen Capture app and what I want to be able to do is that the mbm file should automatically get saved in a given format say .bmp or .jpeg in the images folder of the target device.
    How do I acheive that functionality ?

    Thanks a million !!!!!!!

  8. #8
    Nokia Developer Moderator
    Join Date
    Mar 2003
    Location
    Lempäälä/Finland
    Posts
    29,144

    Re: CopyScreenToBitmap() problem

    you have to implement the image conversion process while saving the file then. Good example of the JPG saver code could be found for exxample from the remote camera example, that can be found from this forum.

    yucca

  9. #9
    Regular Contributor
    Join Date
    Aug 2005
    Posts
    151

    Re: CopyScreenToBitmap() problem

    Quote Originally Posted by razas
    Thanks a lot , gir...for ur invaluable help . I was able to extract the bmp from the mbm file using
    Code:
    bmconv /u screen.mbm screen.bmp
    on the PC and that verifies that the screen has been captured successfully.
    However Im in the process of making a Screen Capture app and what I want to be able to do is that the mbm file should automatically get saved in a given format say .bmp or .jpeg in the images folder of the target device.
    How do I acheive that functionality ?

    Thanks a million !!!!!!!
    When I do this that is extracting bmp from mbm, I get compeletely black image.
    While the same code works fine on emulator.
    Can anybody help..
    Cheers,
    Manan

Similar Threads

  1. Problem with eglSwapBuffers and heap corruption
    By greatape in forum Symbian Media (Closed)
    Replies: 2
    Last Post: 2007-05-24, 03:35
  2. netcards - Problem with opening adapter
    By kernj in forum Symbian Tools & SDKs
    Replies: 5
    Last Post: 2007-01-10, 08:56
  3. WAP service problem on Apache
    By bigg_o in forum Browsing and Mark-ups
    Replies: 3
    Last Post: 2005-04-17, 16:05
  4. Problem: S60 SDK for CW in PC with .NET
    By anttij in forum Carbide.c++ IDE and plug-ins (Closed)
    Replies: 1
    Last Post: 2005-02-28, 11:36

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •