Click here to Skip to main content
15,918,808 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: What's going on? Please help me Pin
Joaquín M López Muñoz23-Jan-02 10:04
Joaquín M López Muñoz23-Jan-02 10:04 
GeneralRe: What's going on? Please help me Pin
User 665823-Jan-02 10:11
User 665823-Jan-02 10:11 
GeneralRe: What's going on? Please help me Pin
Ravi Bhavnani23-Jan-02 10:16
professionalRavi Bhavnani23-Jan-02 10:16 
GeneralRe: What's going on? Please help me Pin
User 665823-Jan-02 10:41
User 665823-Jan-02 10:41 
GeneralRe: What's going on? Please help me Pin
Le centriste23-Jan-02 10:57
Le centriste23-Jan-02 10:57 
GeneralRe: What's going on? Please help me Pin
User 665823-Jan-02 11:00
User 665823-Jan-02 11:00 
GeneralPROBLEM SOLVED!!! Pin
User 665823-Jan-02 11:06
User 665823-Jan-02 11:06 
GeneralProblem with WM_NOTIFY from a ClistViewCtrl Pin
uo200023-Jan-02 7:29
uo200023-Jan-02 7:29 
I have an application that handles the LVN_GETDISPINFO notification from a view ClistViewCtrl. The listview contents is in an array so I just call m_view.SetItemCountEx( m_Count, 0 ); to tell the listview how many rows I have and then handle all the icons and text when the listview sends a LVN_GETDISPINFO notification.

I wanted to go further and also store the state information in my array as well so the LVN_SETDISPINFO would be a great help there.
When I add the LVN_SETDISPINFO and LVN_ODSTATECHANGED notifications they never come up in the message map of the mainfram window. Is there anyone that knows why this is or have any tips on how to get information on how it should be done to make it work?
All input will be very appreciated.

I put some trace code in the message map but there is nothing about either the ANSI or UNICODE notification showing up. No message comes up in Spy++ either. There is probably something missing but I can not figure out what. I have not seen a working example of the LVN_SETDISPINFO so I have no reference.

When I try m_view.SetCallbackMask( LVIS_FOCUSED ); It seams to understand this because the focus has disappeared from the list, and if I also add the LVIS_SELECTED the selections also disappears unless I set the state my self in LVN_GETDISPINFO.

I have followed this group, searched the internet and been to MSDN and read in the help for CListViewCtrl, the only thing I found was about WM_NOTIFYFORMAT that I also put in.

Below is excerpts from the source.

Thanks in advance
Ulf


In the _tWinMain:
iccx.dwSize = sizeof(iccx);
iccx.dwICC = ICC_WIN95_CLASSES;
//iccx.dwICC = ICC_COOL_CLASSES | ICC_BAR_CLASSES | ICC_LISTVIEW_CLASSES;
BOOL bRet = ::InitCommonControlsEx(&iccx);



The definition of the ClistViewCtrl as follows:
typedef CWinTraits<ws_child |="" ws_visible="" ws_clipsiblings="" ws_clipchildren="" |ws_vscroll="" lvs_report="" lvs_showselalways="" lvs_singlesel="" lvs_shareimagelists="" |lvs_ownerdata,="" ws_ex_clientedge=""> LexinUpdateTraits;

class CLexinUpdateView : public CWindowImpl<clexinupdateview, clistviewctrl,="" lexinupdatetraits="">, public CCustomDraw<clexinupdateview>
{
public:
DECLARE_WND_SUPERCLASS(NULL, ListViewCtrl::GetWndClassName())
typedef CWindowImpl<clexinupdateview, clistviewctrl=""> winbaseClass;

BEGIN_MSG_MAP(CLexinUpdateView)
MESSAGE_HANDLER(WM_CREATE, OnCreate)
NOTIFY_CODE_HANDLER(HDN_ITEMCLICKA, OnHeaderClicked)
NOTIFY_CODE_HANDLER(HDN_ITEMCLICKW, OnHeaderClicked)
//CHAIN_MSG_MAP(winbaseClass)
END_MSG_MAP()

BOOL PreTranslateMessage(MSG* pMsg)
{
pMsg;
return FALSE;
}


The definition of the mainframe is as follows:
class CMainFrame : public CFrameWindowImpl<cmainframe>,public CUpdateUI<cmainframe>, public CMessageFilter, public CIdleHandler
{
public:
DECLARE_FRAME_WND_CLASS(NULL, IDR_MAINFRAME)

typedef CFrameWindowImpl<cmainframe> winbaseClass;


virtual BOOL PreTranslateMessage(MSG* pMsg)
{
if(CFrameWindowImpl<cmainframe>::PreTranslateMessage(pMsg))
return TRUE;

return m_view.PreTranslateMessage(pMsg);

}

public:
BEGIN_MSG_MAP(CMainFrame)
MESSAGE_HANDLER(WM_CREATE, OnCreate)
MESSAGE_HANDLER(WM_CLOSE, OnClose)
MESSAGE_HANDLER(WM_NOTIFYFORMAT, OnNotifyFormat)

NOTIFY_HANDLER(IDC_LISTVIEW,LVN_SETDISPINFO,OnSetdispinfoLexinview)
NOTIFY_HANDLER(IDC_LISTVIEW,LVN_GETDISPINFO,OnGetdispinfoLexinview)
NOTIFY_HANDLER(IDC_LISTVIEW,LVN_ODSTATECHANGED,OnODStateChangedLexinview)

CHAIN_MSG_MAP(CUpdateUI<cmainframe>)
CHAIN_MSG_MAP(winbaseClass)
END_MSG_MAP()


// Message handlers
LRESULT OnCreate( UINT, WPARAM, LPARAM, BOOL& );
LRESULT OnClose( UINT, WPARAM, LPARAM, BOOL& );
LRESULT OnNotifyFormat( UINT, WPARAM, LPARAM, BOOL& );

LRESULT OnSetdispinfoLexinview(int idCtrl, LPNMHDR pnmh, BOOL& bHandled);
LRESULT OnGetdispinfoLexinview(int idCtrl, LPNMHDR pnmh, BOOL& bHandled);
LRESULT OnODStateChangedLexinview(int idCtrl, LPNMHDR pnmh, BOOL& bHandled);



The list view is initialised as follows in the mainframe OnCreate():
m_hWndClient = m_view.Create(m_hWnd, rcDefault, NULL, 0, 0, IDC_LISTVIEW);
ATLASSERT(::IsWindow(m_hWndClient));

// Style must be set for edit labels and ownerdraw
m_view.SetExtendedListViewStyle( LVS_EX_FULLROWSELECT|LVS_EX_HEADERDRAGDROP|LVS_EX_INFOTIP );

m_view.InitImageList( IDB_LIST_STATES );
//m_view.SetCallbackMask( LVIS_FOCUSED|LVIS_SELECTED );
m_view.SetCallbackMask( LVIS_FOCUSED );
Generalwhatif (ptr = malloc ( nSize ) ) == NULL Pin
Mike Doner23-Jan-02 6:25
Mike Doner23-Jan-02 6:25 
GeneralRe: whatif (ptr = malloc ( nSize ) ) == NULL Pin
Joaquín M López Muñoz23-Jan-02 10:24
Joaquín M López Muñoz23-Jan-02 10:24 
GeneralDouble Buffering vs. Private DC's Pin
Mark Lenz23-Jan-02 4:56
Mark Lenz23-Jan-02 4:56 
GeneralRe: Double Buffering vs. Private DC's Pin
Mark Lenz23-Jan-02 7:58
Mark Lenz23-Jan-02 7:58 
GeneralRe: Double Buffering vs. Private DC's Pin
Michael Dunn23-Jan-02 8:15
sitebuilderMichael Dunn23-Jan-02 8:15 
GeneralRe: Double Buffering vs. Private DC's Pin
Mark Lenz23-Jan-02 10:16
Mark Lenz23-Jan-02 10:16 
GeneralRe: Double Buffering vs. Private DC's Pin
Shog923-Jan-02 15:28
sitebuilderShog923-Jan-02 15:28 
GeneralRe: Double Buffering vs. Private DC's Pin
Michael Dunn23-Jan-02 19:24
sitebuilderMichael Dunn23-Jan-02 19:24 
GeneralRe: Double Buffering vs. Private DC's Pin
Mark Lenz23-Jan-02 11:22
Mark Lenz23-Jan-02 11:22 
GeneralCDROM Information Pin
Adrian Metcalfe23-Jan-02 4:42
Adrian Metcalfe23-Jan-02 4:42 
GeneralRe: CDROM Information Pin
moliate23-Jan-02 15:29
moliate23-Jan-02 15:29 
GeneralAFX_EXT_CLASS no assure export Pin
Franck George23-Jan-02 4:25
Franck George23-Jan-02 4:25 
GeneralRe: AFX_EXT_CLASS no assure export Pin
Joao Vaz23-Jan-02 4:43
Joao Vaz23-Jan-02 4:43 
GeneralRe: AFX_EXT_CLASS no assure export Pin
Joao Vaz23-Jan-02 4:46
Joao Vaz23-Jan-02 4:46 
GeneralRe: AFX_EXT_CLASS no assure export Pin
Member 18414215-Jul-10 0:23
Member 18414215-Jul-10 0:23 
GeneralPLEASE Help URGENT Pin
Sonu Kapoor23-Jan-02 4:11
Sonu Kapoor23-Jan-02 4:11 
GeneralVisual C++ & OpenGL Pin
Rajveer23-Jan-02 3:16
Rajveer23-Jan-02 3:16 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.