LVS_OWNERDATA and NM_CUSTOMDRAW with CListCtrl == slow?

Forgive me if this is a near duplicate post... anyway, I'm trying to use
NM_CUSTOMDRAW to draw all the items manually in a virtual CListCtrl (a list
control with LVS_OWNERDATA). The problem is that my method is very slow and
sluggish feeling compared to the way windows does it, and I don't know why.
Keeping in mind that NM_CUSTOMDRAW is only fired once per item, due to the
LVS_OWERDATA style, rather than once per sub item, perhaps someone can
explain to me what I'm doing wrong? Heres the code:

void CMusikPlaylistCtrl::OnLvnGetdispinfo(NMHDR *pNMHDR, LRESULT *pResult)
{
    NMLVDISPINFO *pDispInfo = reinterpret_cast<NMLVDISPINFO*>(pNMHDR);

    // NM_CUSTOMDRAW will take care of drawing

    *pResult = 0;
}

void CMusikPlaylistCtrl::OnNMCustomdraw(NMHDR *pNMHDR, LRESULT *pResult)
{
     NMLVCUSTOMDRAW* pLVCD = reinterpret_cast<NMLVCUSTOMDRAW*>( pNMHDR );

    *pResult = CDRF_DODEFAULT;


    if ( CDDS_PREPAINT == pLVCD->nmcd.dwDrawStage )
        *pResult = CDRF_NOTIFYITEMDRAW;

    else if ( CDDS_ITEMPREPAINT == pLVCD->nmcd.dwDrawStage )
    {
        int iRow = (int)pLVCD->nmcd.dwItemSpec;

        CDC* pDC = CDC::FromHandle(pLVCD->nmcd.hdc);
        CRect item_rect;
        GetItemRect( iRow, &item_rect, LVIR_BOUNDS );

        DrawItem( pDC, iRow, item_rect ); // draw item [see below]
        *pResult = CDRF_SKIPDEFAULT;
    }

    else if( pLVCD->nmcd.dwDrawStage == CDDS_ITEMPOSTPAINT )
    *pResult = CDRF_DODEFAULT;
}

void CMusikPlaylistCtrl::DrawItem( CDC* pDC, int item, const CRect& rect )
{
    CMemDC dc( pDC, &rect );

    // setup the font and highlight colors
    COLORREF bg = GetSysColor( COLOR_BTNHILIGHT );
    COLORREF text = GetSysColor( COLOR_WINDOWTEXT );

    // color each sub item
    CRect rcSubItem;
    dc.SetTextColor( text );
    for ( size_t i = 0; i < m_Prefs->GetPlaylistColCount(); i++ )
    {
        GetSubItemRect( item, i, LVIR_BOUNDS, rcSubItem );

        dc.FillSolidRect( &rcSubItem, bg );
        dc.TextOut( rcSubItem.left + 6, rcSubItem.top, _T( "Test" ) );
    }
}

Any suggestions or advice as to how to speed this up would be much
appreciated. Thanks!

Casey


0
casey678 (6)
10/30/2003 7:54:51 PM
vc.mfc 33608 articles. 0 followers. Follow

4 Replies
2490 Views

Similar Articles

[PageSpeed] 14

If all you're doing is changing background and text colors, then there's no
reason to get a device context and draw into it.  Custom draw lets you do
this directly, by changing the values of pLVCD->clrText and pLVCD->clrTextBk
..  See this article: http://www.codeproject.com/listctrl/lvcustomdraw.asp

If you proceed this way, then you will need to implement the
OnLvnGetdispinfo() handler.  You should probably do this anyway, since there
are many instances where you might want to get the text for your item
directly from the list control (it might be simpler than going to your
document, or you might not have a handy pointer to your document), even
though the control is virtual.  As you have it set up, for example, a call
to CListCtrl::GetItemText() will return nothing.


"Casey Langen" <casey@bak.rr.com> wrote in message
news:f0eob.8496$cw4.41927934@newssvr21.news.prodigy.com...
> Forgive me if this is a near duplicate post... anyway, I'm trying to use
> NM_CUSTOMDRAW to draw all the items manually in a virtual CListCtrl (a
list
> control with LVS_OWNERDATA). The problem is that my method is very slow
and
> sluggish feeling compared to the way windows does it, and I don't know
why.
> Keeping in mind that NM_CUSTOMDRAW is only fired once per item, due to the
> LVS_OWERDATA style, rather than once per sub item, perhaps someone can
> explain to me what I'm doing wrong? Heres the code:
>
> void CMusikPlaylistCtrl::OnLvnGetdispinfo(NMHDR *pNMHDR, LRESULT *pResult)
> {
>     NMLVDISPINFO *pDispInfo = reinterpret_cast<NMLVDISPINFO*>(pNMHDR);
>
>     // NM_CUSTOMDRAW will take care of drawing
>
>     *pResult = 0;
> }
>
> void CMusikPlaylistCtrl::OnNMCustomdraw(NMHDR *pNMHDR, LRESULT *pResult)
> {
>      NMLVCUSTOMDRAW* pLVCD = reinterpret_cast<NMLVCUSTOMDRAW*>( pNMHDR );
>
>     *pResult = CDRF_DODEFAULT;
>
>
>     if ( CDDS_PREPAINT == pLVCD->nmcd.dwDrawStage )
>         *pResult = CDRF_NOTIFYITEMDRAW;
>
>     else if ( CDDS_ITEMPREPAINT == pLVCD->nmcd.dwDrawStage )
>     {
>         int iRow = (int)pLVCD->nmcd.dwItemSpec;
>
>         CDC* pDC = CDC::FromHandle(pLVCD->nmcd.hdc);
>         CRect item_rect;
>         GetItemRect( iRow, &item_rect, LVIR_BOUNDS );
>
>         DrawItem( pDC, iRow, item_rect ); // draw item [see below]
>         *pResult = CDRF_SKIPDEFAULT;
>     }
>
>     else if( pLVCD->nmcd.dwDrawStage == CDDS_ITEMPOSTPAINT )
>     *pResult = CDRF_DODEFAULT;
> }
>
> void CMusikPlaylistCtrl::DrawItem( CDC* pDC, int item, const CRect& rect )
> {
>     CMemDC dc( pDC, &rect );
>
>     // setup the font and highlight colors
>     COLORREF bg = GetSysColor( COLOR_BTNHILIGHT );
>     COLORREF text = GetSysColor( COLOR_WINDOWTEXT );
>
>     // color each sub item
>     CRect rcSubItem;
>     dc.SetTextColor( text );
>     for ( size_t i = 0; i < m_Prefs->GetPlaylistColCount(); i++ )
>     {
>         GetSubItemRect( item, i, LVIR_BOUNDS, rcSubItem );
>
>         dc.FillSolidRect( &rcSubItem, bg );
>         dc.TextOut( rcSubItem.left + 6, rcSubItem.top, _T( "Test" ) );
>     }
> }
>
> Any suggestions or advice as to how to speed this up would be much
> appreciated. Thanks!
>
> Casey
>
>


0
10/30/2003 8:48:57 PM
Well, the real reason I'm doing this is becuase I need one of the columns to
be displayed in a different font. Is there another way to do that besides
drawing it myself? Thanks :)

Casey

"Michael K. O'Neill" <MikeAThon2000@nospam-hotmail.com> wrote in message
news:e%23$q%23iynDHA.2964@tk2msftngp13.phx.gbl...
> If all you're doing is changing background and text colors, then there's
no
> reason to get a device context and draw into it.  Custom draw lets you do
> this directly, by changing the values of pLVCD->clrText and
pLVCD->clrTextBk
> .  See this article: http://www.codeproject.com/listctrl/lvcustomdraw.asp
>
> If you proceed this way, then you will need to implement the
> OnLvnGetdispinfo() handler.  You should probably do this anyway, since
there
> are many instances where you might want to get the text for your item
> directly from the list control (it might be simpler than going to your
> document, or you might not have a handy pointer to your document), even
> though the control is virtual.  As you have it set up, for example, a call
> to CListCtrl::GetItemText() will return nothing.
>
>
> "Casey Langen" <casey@bak.rr.com> wrote in message
> news:f0eob.8496$cw4.41927934@newssvr21.news.prodigy.com...
> > Forgive me if this is a near duplicate post... anyway, I'm trying to use
> > NM_CUSTOMDRAW to draw all the items manually in a virtual CListCtrl (a
> list
> > control with LVS_OWNERDATA). The problem is that my method is very slow
> and
> > sluggish feeling compared to the way windows does it, and I don't know
> why.
> > Keeping in mind that NM_CUSTOMDRAW is only fired once per item, due to
the
> > LVS_OWERDATA style, rather than once per sub item, perhaps someone can
> > explain to me what I'm doing wrong? Heres the code:
> >
> > void CMusikPlaylistCtrl::OnLvnGetdispinfo(NMHDR *pNMHDR, LRESULT
*pResult)
> > {
> >     NMLVDISPINFO *pDispInfo = reinterpret_cast<NMLVDISPINFO*>(pNMHDR);
> >
> >     // NM_CUSTOMDRAW will take care of drawing
> >
> >     *pResult = 0;
> > }
> >
> > void CMusikPlaylistCtrl::OnNMCustomdraw(NMHDR *pNMHDR, LRESULT *pResult)
> > {
> >      NMLVCUSTOMDRAW* pLVCD = reinterpret_cast<NMLVCUSTOMDRAW*>(
pNMHDR );
> >
> >     *pResult = CDRF_DODEFAULT;
> >
> >
> >     if ( CDDS_PREPAINT == pLVCD->nmcd.dwDrawStage )
> >         *pResult = CDRF_NOTIFYITEMDRAW;
> >
> >     else if ( CDDS_ITEMPREPAINT == pLVCD->nmcd.dwDrawStage )
> >     {
> >         int iRow = (int)pLVCD->nmcd.dwItemSpec;
> >
> >         CDC* pDC = CDC::FromHandle(pLVCD->nmcd.hdc);
> >         CRect item_rect;
> >         GetItemRect( iRow, &item_rect, LVIR_BOUNDS );
> >
> >         DrawItem( pDC, iRow, item_rect ); // draw item [see below]
> >         *pResult = CDRF_SKIPDEFAULT;
> >     }
> >
> >     else if( pLVCD->nmcd.dwDrawStage == CDDS_ITEMPOSTPAINT )
> >     *pResult = CDRF_DODEFAULT;
> > }
> >
> > void CMusikPlaylistCtrl::DrawItem( CDC* pDC, int item, const CRect&
rect )
> > {
> >     CMemDC dc( pDC, &rect );
> >
> >     // setup the font and highlight colors
> >     COLORREF bg = GetSysColor( COLOR_BTNHILIGHT );
> >     COLORREF text = GetSysColor( COLOR_WINDOWTEXT );
> >
> >     // color each sub item
> >     CRect rcSubItem;
> >     dc.SetTextColor( text );
> >     for ( size_t i = 0; i < m_Prefs->GetPlaylistColCount(); i++ )
> >     {
> >         GetSubItemRect( item, i, LVIR_BOUNDS, rcSubItem );
> >
> >         dc.FillSolidRect( &rcSubItem, bg );
> >         dc.TextOut( rcSubItem.left + 6, rcSubItem.top, _T( "Test" ) );
> >     }
> > }
> >
> > Any suggestions or advice as to how to speed this up would be much
> > appreciated. Thanks!
> >
> > Casey
> >
> >
>
>


0
casey678 (6)
10/30/2003 10:06:15 PM
For that sub-item, return CDRF_NEWFONT from the custom draw handler, after
selecting your desired font into the dvice context supplied in pLVCD.  The
procedure is outlined in this comment found in the same article sent to you
earlier:

http://www.codeproject.com/listctrl/lvcustomdraw.asp#xx539737xx

Incidentally, why do you say that you only get one custom draw notification
per item?  That's not the way custom draw works.  You actually get many
notifications for each item, and in fact get many for each sub-item.  The
docs says you get them at various draw stages throughout the drawing of each
sub-item.

Are you certain you're returning the correct values for CDRF_XXX?  You won't
get follow-up notifications, for later draw stages, if you're not returning
the correct values.


"Casey Langen" <casey@bak.rr.com> wrote in message
news:rXfob.310$Ch2.96@newssvr29.news.prodigy.com...
> Well, the real reason I'm doing this is becuase I need one of the columns
to
> be displayed in a different font. Is there another way to do that besides
> drawing it myself? Thanks :)
>
> Casey
>
> "Michael K. O'Neill" <MikeAThon2000@nospam-hotmail.com> wrote in message
> news:e%23$q%23iynDHA.2964@tk2msftngp13.phx.gbl...
> > If all you're doing is changing background and text colors, then there's
> no
> > reason to get a device context and draw into it.  Custom draw lets you
do
> > this directly, by changing the values of pLVCD->clrText and
> pLVCD->clrTextBk
> > .  See this article:
http://www.codeproject.com/listctrl/lvcustomdraw.asp
> >
> > If you proceed this way, then you will need to implement the
> > OnLvnGetdispinfo() handler.  You should probably do this anyway, since
> there
> > are many instances where you might want to get the text for your item
> > directly from the list control (it might be simpler than going to your
> > document, or you might not have a handy pointer to your document), even
> > though the control is virtual.  As you have it set up, for example, a
call
> > to CListCtrl::GetItemText() will return nothing.
> >
> >
> > "Casey Langen" <casey@bak.rr.com> wrote in message
> > news:f0eob.8496$cw4.41927934@newssvr21.news.prodigy.com...
> > > Forgive me if this is a near duplicate post... anyway, I'm trying to
use
> > > NM_CUSTOMDRAW to draw all the items manually in a virtual CListCtrl (a
> > list
> > > control with LVS_OWNERDATA). The problem is that my method is very
slow
> > and
> > > sluggish feeling compared to the way windows does it, and I don't know
> > why.
> > > Keeping in mind that NM_CUSTOMDRAW is only fired once per item, due to
> the
> > > LVS_OWERDATA style, rather than once per sub item, perhaps someone can
> > > explain to me what I'm doing wrong? Heres the code:
> > >
> > > void CMusikPlaylistCtrl::OnLvnGetdispinfo(NMHDR *pNMHDR, LRESULT
> *pResult)
> > > {
> > >     NMLVDISPINFO *pDispInfo = reinterpret_cast<NMLVDISPINFO*>(pNMHDR);
> > >
> > >     // NM_CUSTOMDRAW will take care of drawing
> > >
> > >     *pResult = 0;
> > > }
> > >
> > > void CMusikPlaylistCtrl::OnNMCustomdraw(NMHDR *pNMHDR, LRESULT
*pResult)
> > > {
> > >      NMLVCUSTOMDRAW* pLVCD = reinterpret_cast<NMLVCUSTOMDRAW*>(
> pNMHDR );
> > >
> > >     *pResult = CDRF_DODEFAULT;
> > >
> > >
> > >     if ( CDDS_PREPAINT == pLVCD->nmcd.dwDrawStage )
> > >         *pResult = CDRF_NOTIFYITEMDRAW;
> > >
> > >     else if ( CDDS_ITEMPREPAINT == pLVCD->nmcd.dwDrawStage )
> > >     {
> > >         int iRow = (int)pLVCD->nmcd.dwItemSpec;
> > >
> > >         CDC* pDC = CDC::FromHandle(pLVCD->nmcd.hdc);
> > >         CRect item_rect;
> > >         GetItemRect( iRow, &item_rect, LVIR_BOUNDS );
> > >
> > >         DrawItem( pDC, iRow, item_rect ); // draw item [see below]
> > >         *pResult = CDRF_SKIPDEFAULT;
> > >     }
> > >
> > >     else if( pLVCD->nmcd.dwDrawStage == CDDS_ITEMPOSTPAINT )
> > >     *pResult = CDRF_DODEFAULT;
> > > }
> > >
> > > void CMusikPlaylistCtrl::DrawItem( CDC* pDC, int item, const CRect&
> rect )
> > > {
> > >     CMemDC dc( pDC, &rect );
> > >
> > >     // setup the font and highlight colors
> > >     COLORREF bg = GetSysColor( COLOR_BTNHILIGHT );
> > >     COLORREF text = GetSysColor( COLOR_WINDOWTEXT );
> > >
> > >     // color each sub item
> > >     CRect rcSubItem;
> > >     dc.SetTextColor( text );
> > >     for ( size_t i = 0; i < m_Prefs->GetPlaylistColCount(); i++ )
> > >     {
> > >         GetSubItemRect( item, i, LVIR_BOUNDS, rcSubItem );
> > >
> > >         dc.FillSolidRect( &rcSubItem, bg );
> > >         dc.TextOut( rcSubItem.left + 6, rcSubItem.top, _T( "Test" ) );
> > >     }
> > > }
> > >
> > > Any suggestions or advice as to how to speed this up would be much
> > > appreciated. Thanks!
> > >
> > > Casey
> > >
> > >
> >
> >
>
>


0
10/30/2003 10:14:54 PM
Thank you very much, I got it to work like a charm! Its still slow, but I
feel this is the proper method to use. Now for the next question -- a method
to change the background color of each alternating item... I can't figure
out an easy way, since CDDS_ITEMPREPAINT must return CDRF_NOTIFYSUBITEMDRAW,
and CDDS_SUBITEM must return CDRF_NEWFONT.  Before I was  See
http://www.skwerm.com/casey/musik_future7.png for what I mean. Any ideas?

Thanks again!

Casey

"Michael K. O'Neill" <MikeAThon2000@nospam-hotmail.com> wrote in message
news:OUa6UVznDHA.2528@TK2MSFTNGP12.phx.gbl...
> For that sub-item, return CDRF_NEWFONT from the custom draw handler, after
> selecting your desired font into the dvice context supplied in pLVCD.  The
> procedure is outlined in this comment found in the same article sent to
you
> earlier:
>
> http://www.codeproject.com/listctrl/lvcustomdraw.asp#xx539737xx
>
> Incidentally, why do you say that you only get one custom draw
notification
> per item?  That's not the way custom draw works.  You actually get many
> notifications for each item, and in fact get many for each sub-item.  The
> docs says you get them at various draw stages throughout the drawing of
each
> sub-item.
>
> Are you certain you're returning the correct values for CDRF_XXX?  You
won't
> get follow-up notifications, for later draw stages, if you're not
returning
> the correct values.
>
>
> "Casey Langen" <casey@bak.rr.com> wrote in message
> news:rXfob.310$Ch2.96@newssvr29.news.prodigy.com...
> > Well, the real reason I'm doing this is becuase I need one of the
columns
> to
> > be displayed in a different font. Is there another way to do that
besides
> > drawing it myself? Thanks :)
> >
> > Casey
> >
> > "Michael K. O'Neill" <MikeAThon2000@nospam-hotmail.com> wrote in message
> > news:e%23$q%23iynDHA.2964@tk2msftngp13.phx.gbl...
> > > If all you're doing is changing background and text colors, then
there's
> > no
> > > reason to get a device context and draw into it.  Custom draw lets you
> do
> > > this directly, by changing the values of pLVCD->clrText and
> > pLVCD->clrTextBk
> > > .  See this article:
> http://www.codeproject.com/listctrl/lvcustomdraw.asp
> > >
> > > If you proceed this way, then you will need to implement the
> > > OnLvnGetdispinfo() handler.  You should probably do this anyway, since
> > there
> > > are many instances where you might want to get the text for your item
> > > directly from the list control (it might be simpler than going to your
> > > document, or you might not have a handy pointer to your document),
even
> > > though the control is virtual.  As you have it set up, for example, a
> call
> > > to CListCtrl::GetItemText() will return nothing.
> > >
> > >
> > > "Casey Langen" <casey@bak.rr.com> wrote in message
> > > news:f0eob.8496$cw4.41927934@newssvr21.news.prodigy.com...
> > > > Forgive me if this is a near duplicate post... anyway, I'm trying to
> use
> > > > NM_CUSTOMDRAW to draw all the items manually in a virtual CListCtrl
(a
> > > list
> > > > control with LVS_OWNERDATA). The problem is that my method is very
> slow
> > > and
> > > > sluggish feeling compared to the way windows does it, and I don't
know
> > > why.
> > > > Keeping in mind that NM_CUSTOMDRAW is only fired once per item, due
to
> > the
> > > > LVS_OWERDATA style, rather than once per sub item, perhaps someone
can
> > > > explain to me what I'm doing wrong? Heres the code:
> > > >
> > > > void CMusikPlaylistCtrl::OnLvnGetdispinfo(NMHDR *pNMHDR, LRESULT
> > *pResult)
> > > > {
> > > >     NMLVDISPINFO *pDispInfo =
reinterpret_cast<NMLVDISPINFO*>(pNMHDR);
> > > >
> > > >     // NM_CUSTOMDRAW will take care of drawing
> > > >
> > > >     *pResult = 0;
> > > > }
> > > >
> > > > void CMusikPlaylistCtrl::OnNMCustomdraw(NMHDR *pNMHDR, LRESULT
> *pResult)
> > > > {
> > > >      NMLVCUSTOMDRAW* pLVCD = reinterpret_cast<NMLVCUSTOMDRAW*>(
> > pNMHDR );
> > > >
> > > >     *pResult = CDRF_DODEFAULT;
> > > >
> > > >
> > > >     if ( CDDS_PREPAINT == pLVCD->nmcd.dwDrawStage )
> > > >         *pResult = CDRF_NOTIFYITEMDRAW;
> > > >
> > > >     else if ( CDDS_ITEMPREPAINT == pLVCD->nmcd.dwDrawStage )
> > > >     {
> > > >         int iRow = (int)pLVCD->nmcd.dwItemSpec;
> > > >
> > > >         CDC* pDC = CDC::FromHandle(pLVCD->nmcd.hdc);
> > > >         CRect item_rect;
> > > >         GetItemRect( iRow, &item_rect, LVIR_BOUNDS );
> > > >
> > > >         DrawItem( pDC, iRow, item_rect ); // draw item [see below]
> > > >         *pResult = CDRF_SKIPDEFAULT;
> > > >     }
> > > >
> > > >     else if( pLVCD->nmcd.dwDrawStage == CDDS_ITEMPOSTPAINT )
> > > >     *pResult = CDRF_DODEFAULT;
> > > > }
> > > >
> > > > void CMusikPlaylistCtrl::DrawItem( CDC* pDC, int item, const CRect&
> > rect )
> > > > {
> > > >     CMemDC dc( pDC, &rect );
> > > >
> > > >     // setup the font and highlight colors
> > > >     COLORREF bg = GetSysColor( COLOR_BTNHILIGHT );
> > > >     COLORREF text = GetSysColor( COLOR_WINDOWTEXT );
> > > >
> > > >     // color each sub item
> > > >     CRect rcSubItem;
> > > >     dc.SetTextColor( text );
> > > >     for ( size_t i = 0; i < m_Prefs->GetPlaylistColCount(); i++ )
> > > >     {
> > > >         GetSubItemRect( item, i, LVIR_BOUNDS, rcSubItem );
> > > >
> > > >         dc.FillSolidRect( &rcSubItem, bg );
> > > >         dc.TextOut( rcSubItem.left + 6, rcSubItem.top, _T(
"Test" ) );
> > > >     }
> > > > }
> > > >
> > > > Any suggestions or advice as to how to speed this up would be much
> > > > appreciated. Thanks!
> > > >
> > > > Casey
> > > >
> > > >
> > >
> > >
> >
> >
>
>


0
casey678 (6)
10/31/2003 6:57:21 AM
Reply:

Similar Artilces:

NM_CUSTOMDRAW and LVS_OWNERDATA
Hi all, I have a question: I am using a virtual list control (LVS_OWNERDATA), and trying to handle the NM_CUSTOMDRAW message to draw something custom in one of the columns -- problem is, the NM_CUSTOMDRAW message only gets fired once for each item, rather than once for each column. Anyone know how to work around this? Thanks :) Casey This is normal behavior, you will need to draw the entire row when processing the NM_CUSTOMDRAW message. -- ============ Frank Hickman NobleSoft, Inc. ============ "Casey Langen" <avatar5d@hotmail.com> wrote in message news:yQQnb.17925$vi6.1...

CListCtrl draw question
hi there i have implemented a CListCtrl which displays graphic images as normal icons i have created for each item in the list several images relating to unselected, selected, drophilited, and hover states, and have written the code to update the image item index when the appropriate events occur all is going well, except i have one last 'issue' i would like resolve - when an item is selected in LVS_ICON mode in a CListCtrl, the icon's text is painted white on blue, and the icon has some kind of 'mask' applied to it to appear selected - i would like to prevent the icon (...

List View style LVS_EX_CHECKBOXES | LVS_OWNERDATA
LVS_EX_CHECKBOXES does not seem to work in combination with LVS_OWNERDATA. How can i fix that? ...

big CListCtrl
Is there some thing special I need to do if my CListCtrl has 100,000 item each of which has 100 sub item? Thanks, ff Do you mean memory wise? graphics wise? something else? I suppose you might want to disable updating the window after each item is added to prevent massive flickering with SetRedraw(): [http://www.codeguru.com/Cpp/controls/listview/miscellanious/article.php/c89 5/] I can't seem to find it right now, but I remember something about a special CListCtrl that has something to do with memory (MemDC?) that allowed it to be very fast. -- Alec S. alec @ synetech . ...

CListCtrl #17
I am trying to set the extended style LVS_EX_FULLROWSELECT on a CListCtrl but it seems to be ignored - am I doing something wrong? BOOL CMainDialog::OnInitDialog() { CDialog::OnInitDialog(); //....etc....// m_ListAll.SetExtendedStyle(LVS_EX_FULLROWSELECT); } LVS_EX_FULLROWSELECT is available only with list control with report style, LVS_REPORT. Is that the case? -- Vipin Aravind MVP "Tiscali Newsgroups" <oakdaleclose@googlemail.com> wrote in message news:43c62d27$1_1@mk-nntp-2.news.uk.tiscali.com... >I am trying to set the extended style LVS_EX_FULLRO...

ClistCtrl sort
Hi, Does anyone have an example of how sorting can be done in a Clistctrl the same way as in it is done in the windows explorer window? I mean, you can click on the header and it sorts acending or decending on that column. Is this something that is build in to ClistCtrl or do you have to do this manually? Thanks. >Does anyone have an example of how sorting can be done in a Clistctrl >the same way as in it is done in the windows explorer window? I mean, >you can click on the header and it sorts acending or decending on that >column. Is this something that is build in to ClistCt...

Attachments slow to open in Outlook
Hello, I have a client that has random slowness opening attachments (especially Word and Excel) on Outlook 2002/Exchange 2000. We've ruled out network problems. Any other ideas? Do I need to rebuild his mailbox store on the server? Could it be corrupt? More info: The problem occurs at random one to two times per day. Usually with a Microsoft Word or Microsoft Excel spreadsheet that normally would open in a flash, but when he clicks, the response can take 15 to 45 seconds during which Outlook goes into complete freeze (all this time his web-access is fine). No other users have repo...

Which is bester , LVS_OWNERDATA or LPSTR_TEXTCALLBACK ?
Hello , everyone. I see two approach that make application maintain data rather than the control. 1) Use LVS_OWNERDATA style: m_list.Create(WS_CHILD|WS_VISIBLE|LVS_REPORT|LVS_OWNERDATA,...); then handle the LVN_GETDISPINFO message. 2) NO LVS_OWNERDATA ! But set pszText member of LV_ITEM to LPSTR_TEXTCALLBACK, and handle LVN_GETDISPINFO message. like: LV_ITEM Item; Item.lParam = (LPARAM) pItem; // Store the pointer to the object Item.pszText = LPSTR_TEXTCALLBACK; // using callbacks to get the text Item.mask = LVIF_TEXT | LVIF_PARAM; // l...

Extremely slow recalculate after adding cell reference
Excel 2002 (10.6789.6735) SP3 TreePlan add-in (not used in referenced spreadsheet) Hi, I have a spreadsheet with a large number of random numbers being calculated to perform what is essentially Monte Carlo integration. I'm having a very hard time understanding how the calculations work in Excel, such that the calculation time required can increase by many orders of magnitude, after adding a single cell reference. To see what I mean, please download my spreadsheet: https://netfiles.uiuc.edu/jwevans1/www/temp/spreadsheet.zip I have manual calculation disabled. When I manually re...

LVS_OWNERDATA and NM_CUSTOMDRAW with CListCtrl == slow?
Forgive me if this is a near duplicate post... anyway, I'm trying to use NM_CUSTOMDRAW to draw all the items manually in a virtual CListCtrl (a list control with LVS_OWNERDATA). The problem is that my method is very slow and sluggish feeling compared to the way windows does it, and I don't know why. Keeping in mind that NM_CUSTOMDRAW is only fired once per item, due to the LVS_OWERDATA style, rather than once per sub item, perhaps someone can explain to me what I'm doing wrong? Heres the code: void CMusikPlaylistCtrl::OnLvnGetdispinfo(NMHDR *pNMHDR, LRESULT *pResult) { NMLVDIS...

Slow File Open accesst to files
When using Excel 2002, and file open and going to mapped network drive folder that has 1000 files in it, it takes 4 to 5 minutes for the files to be listed in the file open window. If I go to Windows Explorer and browse this same folder the files are shown right away. On a different PC with Excel 2000, the file open list is populated right away. Any ideas? Roger Konwinski My first suggestion would be to move some of those 1000 files into separate subfolders. Not only will it make excel's life easier, it should make it easier for humans, too. But sometimes cleaning up the windows...

Sorting CListCtrl
Hi, I need to sort the items in several of my CListCtrl. I have overloaded the CHeaderCtrl and added a handler for the HDN_ITEMCLICKA and HDN_ITEMCLICKW messages. In the handler I figure out a couple of things (I'm implementing multi column sort) and from there I thought I would call a sort callback or broadcast a message or something. Now I've got one problem: The messages aren't being sent to my overloaded header control! I have subclasses my header control in the PreSubclassWindow function of my CListCtrl: m_wndHeader.SubclassWindow( GetHeaderCtrl()->GetSafeHwnd()); ...

Slow search
I have a printout of an old email that I would like to locate in the Outlook database. I first tried searching on what I though was a unique string within the message. After 30 minutes, the search was still going. Since Outlook does not provide any indication of how far along it is in the search, I had no idea how much longer it would go, so I killed it. It then occurred to me that searching on the date would be a lot faster. I entered a search for the same text string and also the specific date. I killed that one after 10 minutes. I then tried it with only the date and no text string. The s...

RE: NV_CUSTOMDRAW and LVS_OWNERDATA
This is normal behavior, you will need to draw the entire row when processing the NM_CUSTOMDRAW message. D0h. Thats the answer I was looking for :) Cheers! Casey ============ Frank Hickman NobleSoft, Inc. ============ "Casey Langen" <avatar5d@hotmail.com> wrote in message news:yQQnb.17925$vi6.10586@newssvr29.news.prodigy.com... > Hi all, I have a question: > > I am using a virtual list control (LVS_OWNERDATA), and trying to handle the NM_CUSTOMDRAW message to draw something custom in one of the columns -- problem is, the NM_CUSTOMDRAW message only gets fired once f...

problem with CListCtrl
Hi all I have created a list view control using CViewCtrl of MFC .I also apply sorting in list view . Now when I tried to change any entry of coloum one of listView then it makes duplicate entry , mean two entries by same name ..Although there is no duplicate entry in the file where the items of list view are stored , there is only one entry , but in list view itself it shows two entries untill i reopen the application again . Any help amit bharadwaj VC++(ATL,MFC) developer Not sure exactly because you cannot show any code. But I do know that if you add items to a list based clas...

LVS_OWNERDATA and LVM_ENABLEGROUPVIEW Not Compatible???
Hi, I have a list-view control that is working with groups quite well. However, when I turn on the LVS_OWNERDATA style, I can get everything working again BUT the groups. Does anyone know if this is unsupported? Can this be done? Any thoughts? Thanks, Anthony ...

Extremely slow processing
My Excel 2007 spreadsheet has 900,000 rows and 8 columns. All of the cells contain data (no formulas). It takes FOREVER (i.e., hours) to open the worksheet, to insert a column, to delete rows, etc)? What do I need to do to resolve this problem? I tried to reproduce your problem. In a new worksheet I selected A1:H900000, typed 1234, and pressed Ctrl-Enter. That entered data in the selected range so now we're in about the same place per your description. Inserting a column or row, etc., takes about a second. If you try the same thing what do you find? If it's the same as me th...

File deletes unusually slow
A few weeks ago, I first noticed that it takes an unusually long time to delete files on my computer. I'm talking about very small files for the most part, often just 1 KB. I right click on the file, choose delete, and the message about the file being deleted comes up, just like normal. But it can take 10 seconds or more to delete even a tiny file. That doesn't seem right to me. The delete proceeds and succeeds without any error messages. Should I be concerned? If yes, what should I do to fix this? I am running XP Pro with SP2. The computer is just over a year old and h...

slow excel using win2000 sp3
I have an application that loads 15 spreadsheets, performs some calculations and then saves these 15 spreadsheets. Using the same application workbook, I can run the application under win97se in under 3 minutes but under win2000, it takes over a half hour. What gives. Does anyone have an explanation? ...

CLISTCTRL, SORT ROWS
Hi, i am new to vc i have a clistctrl report=view sort = none owner data = false owner data fix = false i just want to click on a button and sort all items onbutton1() { //ascending sort ... m_List1.SortItems() // or whatever } can someone show me real working code? iam trying out for days now. thanks, N. Karademir Smart Software Sorting a list control is a bit obscure, for reasons that escape most of us. It turns out that unlike a listbox, where you get useful stuff in the compare handler, in a list control you get only the LPARAM information (the "itemData"). ...

Slow performance
Any time I want to void the transaction on version 2.00 It takes too long to find the transaction. It takes more than 2 minutes. (tab F11 void a transaction) Is there Any solution to spped up. -- Thank You Harjit SherGill /DBA Altaville Market 324 South Main st po box 370 Altaville CA 95221 Tel : 209-736-1677 vendaliajat@yahoo.com Harjit, We had a problem that appears to be similar to yours. We are also a market and have many transactions per store per day. It seems that with a large number of transactions in the database the recall to void a transaction becomes very slow. The...

Scrollbars and CListCtrl
I am working with CListCtrl window which has only one column, but I really need to suppress appearance of horizontal scroll bar. I tried to modify window style to remove WS_HSCROLL, but seems that MFC overrides me. For now I am suppressing it by loading data, getting client rectangle and setting column width to client rectangle width. Unfortunately this fails with PocketPC WinMobile 5. There GetClientRect seems to return rectangle that includes scrollbar. This adds a problem of now finding the width of vertical scrollbar, solution to which is not obvious to me. There must be a better way to ...

Autofit very slow
hello, I've created a macro to analyse data automatically. At the end I want to format the table in such a way that the entire cell content is visible. Columns("A:N").EntireColumn.AutoFit This worked fine until I've added an additional column. Now, the autofit can take up to a minute before it is done. When I deactivate this line and do it manually I have the same problem. Table : 7570 rows / 14 columns -> autofit done almost immediately 7570 rows / 15 columns -> autofit very slow Has anyone an idea? Thanks in advance. Can't think why this is happen...

CListCtrl name-value pairs?
I've been trying to use the MFC CListCtrl to produce a name-value pair in the same way you do in html. For example I would like to show in the list box the text "somefile.mp3" and if someone selects "somefile.mp3" I would like to have set a value "c:\mp3s\somefile.mp3". Which I can use then to open the file. I noticed lparam but this only excepts integer values? I need both the text shown in the list control and it's value to be strings. Any help would be appreciated. shagy "shagy" <shagy@NOMAIL.com> wrote in message news:e82r7...

Money 2004 slow from a network share
When I keep my Money file on a network share (Windows 2000) Money is very slow. However, when I move it to a local share it is much quicker. The server is a 1.6MHZ P4 with 1.2 GB of memory on a 100MB switched network. Also I have a device called an Audiotron which plays WAV files from my computer on my stereo. When I use Money from the network, the music server pauses like it is not getting the data fast enough. Any ideas? Thanks! John Money does **lots** of very small reads/writes of your data file. These are a worst case for performance since network protocol overhead is so high com...