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

Threaded View

  1. #11
    Join Date
    Sep 2013
    Posts
    5

    Re: [RESOLVED] Creating DialogBar with my own controls (MFC)

    Dear All, (JazzDev, VictorN, ovidiucucu,....everyone)

    Could you help me solve my problem as a continuation of this topic. My problem as follows:
    1) I followed the link : How to Initialize Child Controls in a Derived CDialogBar
    To insert an object of CDialogBar in my app which is written in VC+2005.
    However I gets an error, I could not know why eventhough I have double checked the instruction.
    Details:
    I derived a "CPane1" class from CDialogBar

    Code: Pane1.h

    [/CODE]#pragma once


    // CPane1 dialog

    class CPane1 : public CDialogBar
    {
    DECLARE_DYNAMIC(CPane1)

    public:
    //CPane1(CWnd* pParent = NULL); // standard constructor
    CPane1();

    virtual ~CPane1();

    // Dialog Data
    enum { IDD = IDD_PANE_DIALOG};

    protected:
    virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support
    afx_msg LONG OnInitDialog ( UINT, LONG ); // <-Add this line.

    DECLARE_MESSAGE_MAP()
    };


    Code : Pane1.cpp

    // Pane1.cpp : implementation file
    //

    #include "stdafx.h"
    #include "Sketcher.h"
    #include "Pane1.h"


    IMPLEMENT_DYNAMIC(CPane1, CDialog)


    CPane1::CPane1()
    {

    }

    CPane1::~CPane1()
    {
    }

    void CPane1:oDataExchange(CDataExchange* pDX)
    {
    CDialogBar:oDataExchange(pDX);
    }


    BEGIN_MESSAGE_MAP(CPane1, CDialogBar)

    ON_MESSAGE(WM_INITDIALOG, OnInitDialog )
    END_MESSAGE_MAP()


    // CPane1 message handlers

    LONG CPane1::OnInitDialog ( UINT wParam, LONG lParam)
    {
    //CDialog::OnInitDialog();

    // TODO: Add extra initialization here
    BOOL bRet = HandleInitDialog(wParam, lParam);

    if (!UpdateData(FALSE))
    {
    AfxMessageBox(_T("Warning: UpdateData failed during dialog init.\n"));
    }

    return bRet;

    //return TRUE; // return TRUE unless you set the focus to a control
    // EXCEPTION: OCX Property Pages should return FALSE
    }

    Finally, I create it in CMainFrame:

    CPane1 aPane_Dlg;

    if (!aPane_Dlg.Create(this, IDD_PANE_DIALOG, CBRS_LEFT,
    IDD_PANE_DIALOG))
    {
    TRACE0("Failed to create dialog bar\n");
    return -1; // fail to create
    }



    Thank you so much.
    Attached Files Attached Files

Tags for this Thread

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