15 мая 2023 года "Исходники.РУ" отмечают своё 23-летие!
Поздравляем всех причастных и неравнодушных с этим событием!
И огромное спасибо всем, кто был и остаётся с нами все эти годы!

Главная Форум Журнал Wiki DRKB Discuz!ML Помощь проекту


LVN_GETDISPINFO

Hieu Nguyen -- nguyen_hieu@geocities.com
Tuesday, February 11, 1997

Environment: NT 4.0, VC 4.1
Hi all,

        I derived a class from CListCtrl, lets call CMyListCtrl.
In my derived class I wish to trap the message LVN_GETDISPINFO,
I add overide virtual method CMyListCtrl::OnNotify(), and check
if code is LVN_GETDISPINFO


BOOL CMyListCtrl::OnNotify(WPARAM wParam, LPARAM lParam, LRESULT* 
pResult) 
{
   LV_DISPINFO *pnmv = (LV_DISPINFO FAR *) lParam;
   if ( ((*pnmv).hdr).code == LVN_GETDISPINFO )
      TRACE( "FOUND\n" );
   return CListCtrl ::OnNotify(wParam, lParam, pResult);
}

Using break point to examine the code, I can tell the code never
trapped LVN_GETDISPINFO. I also overide virtual method
CMyListCtrl::WindowProc():

LRESULT CMyListCtrl::WindowProc(UINT message, WPARAM wParam, LPARAM 
lParam) 
{
   LRESULT Result;
   if (message == WM_NOTIFY)
      OnNotify( wParam, lParam, &Result);
   return CListCtrl::WindowProc(message, wParam, lParam);
}

I couldn't trapped LVN_GETDISPINFO either.

Can someone help me with this problem? Thanks in advance.
-Hieu



SOECC01.NUEBEL01 -- SOECC01.NUEBEL01@ssw.alcoa.com
Thursday, February 13, 1997

[Mini-digest: 5 responses]

I don`t know, how your message maps looks like, but
you can use
ON_NOTIFY_REFLECT(LVN_GETDISPINFO, OnGetDispInfo),
to map WM_NOTIFY in your control class (will call CMyListCtrl::OnGetDispInfo)
or you can use
ON_NOTIFY(LVN_GETDISPINFO, IDC_MYCTRLID, OnGetDispInfo),
to map WM_NOTIY in your view class (will call CMyView::OnGetDispInfo).

Seems to me, that you are trying to catch the message in the wrong place,
WM_NOTIFY will go to the parent window, unless you are using message reflection.

-- Markus
============================================================================
  Markus Nuebel                     | voice:  +49 +2921 970-354
  ALCOA Automotive Structures GmbH  |
  Overweg 24                        | e-Mail: SOECC01.NUEBEL01@SSW.ALCOA.COM
  59471 Soest , Germany             | fax:    +49 +2921 970-499
============================================================================


_______________________________________________________________________________

Betreff:LVN_GETDISPINFO

Von:mfc-l@netcom.com bei ~AMSCCSSW

Datum:13.02.1997  3:27 Uhr



Environment: NT 4.0, VC 4.1
Hi all,

        I derived a class from CListCtrl, lets call CMyListCtrl.
In my derived class I wish to trap the message LVN_GETDISPINFO,
I add overide virtual method CMyListCtrl::OnNotify(), and check
if code is LVN_GETDISPINFO


BOOL CMyListCtrl::OnNotify(WPARAM wParam, LPARAM lParam, LRESULT*
pResult)
{*
   LV_DISPINFO *pnmv = (LV_DISPINFO FAR *) lParam;
   if ( ((*pnmv).hdr).code == LVN_GETDISPINFO )
      TRACE( "FOUND\n" );
   return CListCtrl ::OnNotify(wParam, lParam, pResult);
}*

Using break point to examine the code, I can tell the code never
trapped LVN_GETDISPINFO. I also overide virtual method
CMyListCtrl::WindowProc():

LRESULT CMyListCtrl::WindowProc(UINT message, WPARAM wParam, LPARAM
lParam)
{*
   LRESULT Result;
   if (message == WM_NOTIFY)
      OnNotify( wParam, lParam, &Result);
   return CListCtrl::WindowProc(message, wParam, lParam);
}*

I couldn't trapped LVN_GETDISPINFO either.

Can someone help me with this problem? Thanks in advance.
-Hieu
-----From: "Ed Wheeless" 

When adding items to the list control, are you
setting item.pszText = LPSTR_TEXTCALLBACK?


----------
> From: Hieu Nguyen 
> To: mfc-l 
> Subject: LVN_GETDISPINFO
> Date: Tuesday, February 11, 1997 6:10 AM
> 
> Environment: NT 4.0, VC 4.1
> Hi all,
> 
>         I derived a class from CListCtrl, lets call CMyListCtrl.
> In my derived class I wish to trap the message LVN_GETDISPINFO,
> I add overide virtual method CMyListCtrl::OnNotify(), and check
> if code is LVN_GETDISPINFO
> 
> 
> BOOL CMyListCtrl::OnNotify(WPARAM wParam, LPARAM lParam, LRESULT* 
> pResult) 
> {
>    LV_DISPINFO *pnmv = (LV_DISPINFO FAR *) lParam;
>    if ( ((*pnmv).hdr).code == LVN_GETDISPINFO )
>       TRACE( "FOUND\n" );
>    return CListCtrl ::OnNotify(wParam, lParam, pResult);
> }
> 
> Using break point to examine the code, I can tell the code never
> trapped LVN_GETDISPINFO. I also overide virtual method
> CMyListCtrl::WindowProc():
> 
> LRESULT CMyListCtrl::WindowProc(UINT message, WPARAM wParam, LPARAM 
> lParam) 
> {
>    LRESULT Result;
>    if (message == WM_NOTIFY)
>       OnNotify( wParam, lParam, &Result);
>    return CListCtrl::WindowProc(message, wParam, lParam);
> }
> 
> I couldn't trapped LVN_GETDISPINFO either.
> 
> Can someone help me with this problem? Thanks in advance.
> -Hieu
-----From: ktm@ormec.com

On mfc-l, Hieu (nguyen_hieu@geocities.com) wrote:
>         I derived a class from CListCtrl, lets call CMyListCtrl.
> In my derived class I wish to trap the message LVN_GETDISPINFO,
> 
> [code snipped]
> 
> Using break point to examine the code, I can tell the code never
> trapped LVN_GETDISPINFO. 

See the documentation for LVN_GETDISPINFO: 
"The LVN_GETDISPINFO notification message is sent by a list view 
control to its parent window."

You'll never be able to trap LVN_GETDISPINFO in a control derived
from CListView, since the control is *specifically* sending the
notification to its parent window, in this case, the frame window.

  Katy
-- 
Katy Mulvey                            ktm@ormec.com
Software Development Engineer
ORMEC Systems                          http://www.ormec.com
-----From: nabraham@roadshow.com

TO: mfc-l@netcom.com


Hi,

The following code illustrates how to trap LVN_GETDISPINFO message for a   
listview control in property page.

HTH
Naveen

//Header file
class CMyPage : public CPropertyPage
{
public:            
 //assuming CMyListCtrl is derived from CListCtrl
 CMyListCtrl   m_wndListCtrl; //Child Control in propertypage, say its ID   
is IDC_LISTVIEW
protected:
 afx_msg void  OnGetdispinfoListView(NMHDR* pNMHDR, LRESULT* pResult);
 DECLARE_MESSAGE_MAP()
}
//CPP file
BEGIN_MESSAGE_MAP(CMyPage, CPropertyPage)
 ON_NOTIFY(LVN_GETDISPINFO, IDC_LISTVIEW, OnGetdispinfoListView)
END_MESSAGE_MAP()

void CMyPage::OnGetdispinfoListView(NMHDR* lParam, LRESULT* pResult)
{
 LV_DISPINFO *pLvdi = = (LV_DISPINFO *)lParam;
 //here u can call ur (virtual) function
 m_wndList.OnGetdispinfoListView(NMHDR* lParam, LRESULT* pResult)
 ...
 *pResult = 1;
}
 ----------
From:  mfc-l[SMTP:mfc-l@netcom.com]
Sent:  Thursday, February 13, 1997 10:56 AM
To:  mfc-l 
Subject:   LVN_GETDISPINFO

Environment: NT 4.0, VC 4.1
Hi all,

        I derived a class from CListCtrl, lets call CMyListCtrl.
In my derived class I wish to trap the message LVN_GETDISPINFO,
I add overide virtual method CMyListCtrl::OnNotify(), and check
if code is LVN_GETDISPINFO


BOOL CMyListCtrl::OnNotify(WPARAM wParam, LPARAM lParam, LRESULT*
pResult)
{_
   LV_DISPINFO *pnmv = (LV_DISPINFO FAR *) lParam;
   if ( ((*pnmv).hdr).code == LVN_GETDISPINFO )
      TRACE( "FOUND\n" );
   return CListCtrl ::OnNotify(wParam, lParam, pResult);
}_

Using break point to examine the code, I can tell the code never
trapped LVN_GETDISPINFO. I also overide virtual method
CMyListCtrl::WindowProc():

LRESULT CMyListCtrl::WindowProc(UINT message, WPARAM wParam, LPARAM
lParam)
{_
   LRESULT Result;
   if (message == WM_NOTIFY)
      OnNotify( wParam, lParam, &Result);
   return CListCtrl::WindowProc(message, wParam, lParam);
}_

I couldn't trapped LVN_GETDISPINFO either.

Can someone help me with this problem? Thanks in advance.
 -Hieu
-----From: "Gunnar \Vrn Rafnsson" 

The control sends WM_NOTIFY to its parent, so you would have to trap the =
OnNotify message there.

But the control can handle it self if you use

// Clip from ClassWizard generated CMyListCtrl
BEGIN_MESSAGE_MAP(CMyListCtrl, CListCtrl)
	//{{AFX_MSG_MAP(CMyListCtrl)
	ON_NOTIFY_REFLECT(LVN_GETDISPINFO, OnGetdispinfo)
	//}}AFX_MSG_MAP
END_MESSAGE_MAP()

/////////////////////////////////////////////////////////////////////////=
////
// CMyListCtrl message handlers

void CMyListCtrl::OnGetdispinfo(NMHDR* pNMHDR, LRESULT* pResult)=20
{
	LV_DISPINFO* pDispInfo =3D (LV_DISPINFO*)pNMHDR;
	// TODO: Add your control notification handler code here
=09
	*pResult =3D 0;
}


-----Original Message-----
From:	Hieu Nguyen [SMTP:nguyen_hieu@geocities.com]
Sent:	13. febr=FAar 1997 18:17
To:	mfc-l
Subject:	LVN_GETDISPINFO

Environment: NT 4.0, VC 4.1
Hi all,

        I derived a class from CListCtrl, lets call CMyListCtrl.
In my derived class I wish to trap the message LVN_GETDISPINFO,
I add overide virtual method CMyListCtrl::OnNotify(), and check
if code is LVN_GETDISPINFO


BOOL CMyListCtrl::OnNotify(WPARAM wParam, LPARAM lParam, LRESULT*=20
pResult)=20
{=04
   LV_DISPINFO *pnmv =3D (LV_DISPINFO FAR *) lParam;
   if ( ((*pnmv).hdr).code =3D=3D LVN_GETDISPINFO )
      TRACE( "FOUND\n" );
   return CListCtrl ::OnNotify(wParam, lParam, pResult);
}=04

Using break point to examine the code, I can tell the code never
trapped LVN_GETDISPINFO. I also overide virtual method
CMyListCtrl::WindowProc():

LRESULT CMyListCtrl::WindowProc(UINT message, WPARAM wParam, LPARAM=20
lParam)=20
{=04
   LRESULT Result;
   if (message =3D=3D WM_NOTIFY)
      OnNotify( wParam, lParam, &Result);
   return CListCtrl::WindowProc(message, wParam, lParam);
}=04

I couldn't trapped LVN_GETDISPINFO either.

Can someone help me with this problem? Thanks in advance.
-Hieu




Become an MFC-L member | Вернуться в корень Архива |