toolbar not being loaded for dialog dll---extension dll
CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 4 of 4

Thread: toolbar not being loaded for dialog dll---extension dll

  1. #1
    Join Date
    Sep 2007
    Location
    Bangalore,India
    Posts
    163

    Unhappy toolbar not being loaded for dialog dll---extension dll

    i have created an extension dll. where i am loading a dialog from the client mfc application. My dialog has all menubar, toolbar, view. the dll dialog is being loaded but the toolbar is not coming. toolbar is there of the client mfc applications toolbar. My dll dialog toolbar is not being shown. any suggestions what could be the problem??? Thanks in advance

    [code]
    BOOL CDlgsViewDlg::OnInitDialog()
    {
    CDialog::OnInitDialog();

    m_pNewView = new CMyView();
    ShowWindow(SW_SHOWMAXIMIZED);
    CRect clientRect;
    GetClientRect(&clientRect);
    clientRect.DeflateRect(10, 30);
    // Creation of the view window
    if(! m_pNewView->Create(NULL, NULL, WS_VISIBLE | WS_CHILD, clientRect,
    this, WM_USER))
    {
    MessageBox(L"Failed to create view");
    }


    menu.LoadMenu(IDR_MAINFRAME1);
    SetMenu(&menu);


    if(!m_FirstToolBar.CreateEx(this, TBSTYLE_FLAT, WS_CHILD |
    WS_VISIBLE | CBRS_TOP | CBRS_GRIPPER | CBRS_TOOLTIPS |
    CBRS_FLYBY | CBRS_SIZE_DYNAMIC) ||
    !m_FirstToolBar.LoadToolBar(IDR_TOOLBAR1))
    {
    EndDialog(IDCANCEL);
    }

    RepositionBars(AFX_IDW_CONTROLBAR_FIRST, AFX_IDW_CONTROLBAR_LAST,0);

    m_wndStatusBar.Create(this); //We create the status bar

    m_wndStatusBar.SetIndicators(indicators,2); //Set the number of panes

    CRect rect;
    GetClientRect(&rect);
    //Size the two panes
    m_wndStatusBar.SetPaneInfo(0,ID_INDICATOR_NISH,
    SBPS_NORMAL,rect.Width()-100);
    m_wndStatusBar.SetPaneInfo(1,ID_INDICATOR_TIME,SBPS_STRETCH ,0);

    //This is where we actually draw it on the screen
    RepositionBars(AFX_IDW_CONTROLBAR_FIRST,AFX_IDW_CONTROLBAR_LAST,
    ID_INDICATOR_TIME);

    m_wndStatusBar.SetPaneText(0,L"MainWindow Initialized");


    if(!fileName.IsEmpty()) {
    m_pNewView->loadProfile(fileName);
    m_pNewView->domainSetUpForProfile();
    m_pNewView->drawLines();
    m_pNewView->drawArcs();
    m_pNewView->drawProfile();
    m_pNewView->isModel=true;
    m_pNewView->OnGeneratesurface();
    m_pNewView->OnShade();
    m_pNewView->OnIsosouthwest();
    }

    return TRUE; // return TRUE unless you set the focus to a control
    }
    [\code]
    This is the OnInitDialog of my dll dialog where i am loading everything menubar, toolbar calliing some functions etc.
    Please help

  2. #2
    VictorN's Avatar
    VictorN is offline Super Moderator Power Poster
    Join Date
    Jan 2003
    Location
    Wallisellen (ZH), Switzerland
    Posts
    17,466

    Re: toolbar not being loaded for dialog dll---extension dll

    Being here in CG since 2007 but still not knowing how to use Code tags?

    Did you debug your code?
    Victor Nijegorodov

  3. #3
    Join Date
    May 2009
    Location
    Bengaluru, India
    Posts
    422

    Re: toolbar not being loaded for dialog dll---extension dll

    check if you have an instance of the toolbar before you are creating it..

    something like this

    Code:
    m_FirstToolBar = new CToolbar();
    Last edited by vcdebugger; March 13th, 2012 at 03:57 AM.

  4. #4
    ovidiucucu's Avatar
    ovidiucucu is offline Moderator/Reviewer Power Poster
    Join Date
    Feb 2003
    Location
    Iasi - Romania
    Posts
    8,050

    Re: toolbar not being loaded for dialog dll---extension dll

    Have a look in resource.h, both in DLL and application project and asure they have not duplicate resource ID values.
    This is one common problem when we are dealing with MFC extension DLLs.
    Ovidiu Cucu
    "When in Rome, do as Romans do."
    Visit: Microsoft Virtual Academy
    Follow: https://twitter.com/#!/ovidiucucu
    My blog: http://codexpert.ro/blog/author/ovidiu-cucu/

Posting Permissions

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


Windows Mobile Development Center


Click Here to Expand Forum to Full Width

This is a CodeGuru survey question.


Featured


HTML5 Development Center