CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 11 of 11

Threaded View

  1. #9
    Join Date
    Oct 2006
    Posts
    23

    Re: MFC, ListCtrl selection question

    Since DDX_Control accepts CWnd& type for the third variable,

    DDX_Control(pDX, IDC_LIST_TASK, (CWnd&)pListCtrl);

    Does this make sense? I think something's off.

    IDC_LIST_TASK is my ID for the ListControl

    pListCtrl is the member variable for it

    If I put

    DDX_Control(pDX, IDC_LIST_TASK, pListCtrl);

    Compiler complains with the error message of

    error C2664: 'DDX_Control' : cannot convert parameter 3 from 'CListCtrl *' to 'CWnd &'


    [Edit]Project requirement stated it needed to be modaless dialog box as main window.

    Also, here's my header file, in case you wanted to see it

    Code:
    #include <afxwin.h>
    #include <afxcmn.h>
    #include <afxdtctl.h>
    #ifndef _DIALOGASMAINWINDOW_H_
    #define _DIALOGASMAINWINDOW_H_
    
    
    class CMyApp : public CWinApp
    {
    public:
    	virtual BOOL InitInstance();
    };
    
    class CMainDialog : public CDialog
    {
    public:
    	//Constructor for the main dialog
    	CMainDialog();
    
    	//Function Prototype Declarations for Buttons
    	void OnDialogExit();
    	void OnInsertAbove();
    	void OnInsertBelow();
    	void OnAddTask();
    	void OnDeleteTask();
    	
    	//Function Prototype Declarations for Updates
    	void OnUpdateEditCtrl();
    	void OnUpdateListCtrl(NMHDR * pNotifyStruct, LRESULT * result );
    	
    	//Function Prototype Declaration for Initializations for ListCtrl,Month
    	void OnInitListCtrl();
    	void OnInitCalCtrl();
    protected:
    	virtual void DoDataExchange(CDataExchange *pDX);
    	virtual BOOL OnInitDialog();
    	virtual void PostNcDestroy();
    	afx_msg void OnPaint();
    	DECLARE_MESSAGE_MAP()
    private:
    	CListCtrl *pListCtrl;
    	CEdit *l_EditBoxDay;
    	CEdit *l_EditBoxTime;
    	CEdit *l_EditBoxTitle;
    	CTime m_cMonth;
    	CTime m_cTime;
    	CString m_sTitle;
    	int m_itemCount;
    };
    
    
    
    #endif
    Last edited by l46kok; May 4th, 2008 at 03:01 PM.

Posting Permissions

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





Click Here to Expand Forum to Full Width

Featured