FarPoint Forums

The FarPoint Message Boards
Welcome to FarPoint Forums Sign in | Join | Help
in Search

pic cell crash

Last post 11-04-2009, 8:55 AM by seanl. 9 replies.
Sort Posts: Previous Next
  •  10-29-2009, 8:59 AM 84277

    pic cell crash

    hi

    i have one sheet with cca 20 cols, and first is a pic col. Everything works fine until i have over 70 rows and images, after some redrawing program randomly crashes.  After i remove picture cell everything works fine despite the number of rows. I work with unicode spread.

    Error that i get in release is:

      Fault Module Name:    FPSPRU80.ocx
      Fault Module Version:    8.0.0.7
      Fault Module Timestamp:    4a01eb0e
      Exception Code:    c0000005
      Exception Offset:    0008c0d3
      OS Version:    6.0.6002.2.2.0.256.6
      Locale ID:    1050

     In debug it crashes in:

     vctools\vc7libs\ship\atlmfc\include\afxwin1.inl Line:893

     

     Picture is dynamicaly added every time spread refresh with this function:

    void SetPicInCell(CSpreadSheet* m_Spread, UINT IDB_PICTURE, long lRow, long lCol, BOOL bTypePictCenter /*= FALSE*/, BOOL bTypePictMaintainScale /*= FALSE*/, BOOL bTypePictStretch /*= FALSE*/, int nTypeValign /*= 1*/)
    {
        CPictureHolder picture;
        picture.CreateFromBitmap(IDB_PICTURE);
        if(picture.GetPictureDispatch() == NULL)
            return;

        m_Spread->SetRow(lRow);
        m_Spread->SetRow2(lRow);
        m_Spread->SetCol(lCol);
        m_Spread->SetCol2(lCol);
        m_Spread->SetBlockMode(TRUE);
        m_Spread->SetTypePictCenter(bTypePictCenter);
        m_Spread->SetTypePictMaintainScale(bTypePictMaintainScale);
        m_Spread->SetTypePictStretch(bTypePictStretch);
        m_Spread->SetTypeVAlign(nTypeValign);
        m_Spread->SetTypePictPicture(picture.GetPictureDispatch());
        m_Spread->SetBlockMode(FALSE);
    }

     Is there a problem in spread or in my function.

    Thank you.

  •  10-29-2009, 3:23 PM 84297 in reply to 84277

    Re: pic cell crash

    Hello,

    I am not sure what is the reason you are not able set the PictureCellType on the Fly.

    Below is the code that I used to create a PictureCellType and added a picture on a Button Click,

    Private Sub Command1_Click()
         fpSpread1.BlockMode = True
         fpSpread1.Row = 1
         fpSpread1.Col = 1
         fpSpread1.Row2 = 100
         fpSpread1.Col2 = 2
         fpSpread1.CellType = CellTypePic
         fpSpread1.TypePictCenter = True
         fpSpread1.TypePictMaintainScale = True
         fpSpread1.TypePictStretch = True
         fpSpread1.TypeVAlign = TypeVAlignCenter
         fpSpread1.TypePictPicture = fpSpread1.LoadPicture("D:\ImagesIcon\png\folder .png", PictureTypePNG)
         fpSpread1.BlockMode = False
    End Sub

    Please post a small zipped application for us to debug if the issue still persists.

    Thanks,

     

     

     


    Deepak Sharma
    GrapeCity FarPoint
  •  11-02-2009, 7:32 AM 84367 in reply to 84297

    Re: pic cell crash

    Hi, here is a small test project: http://rapidshare.com/files/301342674/TestSpread.rar

     

    1. Problem with pic cells...

    Just click on Start TEST2 and program will start to ClearRange and fill 500 rows of spread 20 times. Then click again on the same button and if you try to move dialog you will see that something is wrong... after some mouse moves or clicks program crashes...

     

     2. UNICODE problem

    In same project I noticed one spread Unicode problem.

    You need to start program again. You will see two col, one is empty, second have some cyrilic. When you double click on it it will open a combo box but there is a problem with text in it. Strange marks are shown instead of text...

    I realized if I go to dialog properties and click on spread properties and change font from default Microsoft Sans Serif to for example Microsoft JhengHei and then return font back to default Microsoft Sans Serif. When you start application again everything works fine, there is no strange marks... if you delete spread and insert new and start application you will have problem again... So my question is is there some error with setting up default font on Unicode spread? I have more then 200 spreads in my app and if i need to change manually font back and forward... it will take me a lot of time :(
  •  11-02-2009, 11:47 AM 84374 in reply to 84367

    Re: pic cell crash

    Hello,

    I am not able to download the project from  http://rapidshare.com/files/301342674/TestSpread.rar.

    You may email your project to fpsupport@fpoint.com along with the link of this Thread.

    Thanks,

     

     

     

     


    Deepak Sharma
    GrapeCity FarPoint
  •  11-03-2009, 9:27 AM 84401 in reply to 84277

    Re: pic cell crash

    m3ow:

    hi

    i have one sheet with cca 20 cols, and first is a pic col. Everything works fine until i have over 70 rows and images, after some redrawing program randomly crashes.  After i remove picture cell everything works fine despite the number of rows. I work with unicode spread.

    Error that i get in release is:

      Fault Module Name:    FPSPRU80.ocx
      Fault Module Version:    8.0.0.7
      Fault Module Timestamp:    4a01eb0e
      Exception Code:    c0000005
      Exception Offset:    0008c0d3
      OS Version:    6.0.6002.2.2.0.256.6
      Locale ID:    1050

     In debug it crashes in:

     vctools\vc7libs\ship\atlmfc\include\afxwin1.inl Line:893

     

     Picture is dynamicaly added every time spread refresh with this function:

    void SetPicInCell(CSpreadSheet* m_Spread, UINT IDB_PICTURE, long lRow, long lCol, BOOL bTypePictCenter /*= FALSE*/, BOOL bTypePictMaintainScale /*= FALSE*/, BOOL bTypePictStretch /*= FALSE*/, int nTypeValign /*= 1*/)
    {
        CPictureHolder picture;
        picture.CreateFromBitmap(IDB_PICTURE);
        if(picture.GetPictureDispatch() == NULL)
            return;

        m_Spread->SetRow(lRow);
        m_Spread->SetRow2(lRow);
        m_Spread->SetCol(lCol);
        m_Spread->SetCol2(lCol);
        m_Spread->SetBlockMode(TRUE);
        m_Spread->SetTypePictCenter(bTypePictCenter);
        m_Spread->SetTypePictMaintainScale(bTypePictMaintainScale);
        m_Spread->SetTypePictStretch(bTypePictStretch);
        m_Spread->SetTypeVAlign(nTypeValign);
        m_Spread->SetTypePictPicture(picture.GetPictureDispatch());
        m_Spread->SetBlockMode(FALSE);
    }

     Is there a problem in spread or in my function.

    Thank you.

    Hi,

    There is a problem in your code (it leaks memory) -- calling picture.GetPictureDispatch() will add a reference to the IPicture object which must be released in your code.  You need to add a call to picture.m_pPict->Release() after the check for NULL and the return.  Spread will release the reference passed into SetTypePictPicture.


    seanl
    Product Manager, FarPoint Spread for Windows Forms (.NET), FarPoint Spread COM
    GrapeCity FarPoint
  •  11-03-2009, 10:00 AM 84402 in reply to 84401

    Re: pic cell crash

    I added release code but there is still a problem... I sended project to mail
  •  11-03-2009, 10:49 AM 84403 in reply to 84401

    Re: pic cell crash

    I have looked at it further, and it appears that change I suggested is not sufficient.

    Your code is exhausting the resource handles by creating too many separate Picture objects.

    If you change your code to reduce the number of Picture objects created to the minimum number, then the problem should not happen.

    I suggest adding LPPICTUREDISP fields to your class and initializing them in the constructor with CPictureHolder objects the way you are in your helper function, but just once for each picture.  Then you can call Release on these objects in a destructor for your dialog class, and use those objects to pass into the SetPicInCell code instead of UINT.  Then there will only be four Picture objects created and reused in the cells, rather than many copies of the same image which each use a different HBITMAP.


    seanl
    Product Manager, FarPoint Spread for Windows Forms (.NET), FarPoint Spread COM
    GrapeCity FarPoint
  •  11-03-2009, 4:22 PM 84412 in reply to 84403

    Re: pic cell crash

    I have been looking into the other issue with the font for the combo box list, and it seems to work when I add this line of code at the top of the FormatSpread() function:

      m_Spread.SetFontName(_T("MS Shell Dlg"));


    seanl
    Product Manager, FarPoint Spread for Windows Forms (.NET), FarPoint Spread COM
    GrapeCity FarPoint
  •  11-04-2009, 2:58 AM 84421 in reply to 84412

    Re: pic cell crash

    For first issue I changed code as you suggested and now all works fine. For second, ok, i will do that or just change font forward and backward on properties, same result. But i posted it to inform you that maybe something is not working 100% right so you can check it for further releases.

    Thank you for your time. Best regards.

     

  •  11-04-2009, 8:55 AM 84430 in reply to 84421

    Re: pic cell crash

    Hi,

    I will forward the issue to development for review.  It is strange that the text works in the combo edit box but not the list.  The list is supposed to use the same font.

    Thanks for letting us know about this issue!


    seanl
    Product Manager, FarPoint Spread for Windows Forms (.NET), FarPoint Spread COM
    GrapeCity FarPoint
View as RSS news feed in XML
     FarPoint Forums Home