Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9026233
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 16, 20262026-06-16T06:28:06+00:00 2026-06-16T06:28:06+00:00

I created a SDI application and I created a Dialog Window. I want to

  • 0

I created a SDI application and I created a Dialog Window. I want to add a toolbar to that dialog, so I coded like this :

int CAddNewEmployee::OnCreate(LPCREATESTRUCT lpCreateStruct)
{
    if (CDialog::OnCreate(lpCreateStruct) == -1)
      return -1;

   CToolBar cToolBar;
   cToolBar.Create(this);
   cToolBar.LoadToolBar(IDR_MAINFRAME1);
   cToolBar.ShowWindow(SW_SHOW);
   cToolBar.SetBarStyle(CBRS_ALIGN_TOP | CBRS_TOOLTIPS | CBRS_FLYBY);
   RepositionBars(AFX_IDW_CONTROLBAR_FIRST, AFX_IDW_CONTROLBAR_LAST, 0);

   return 0;

}

but when I run the application nothing happen, there is no toolbar shown. I don’t know if the code is right and how to make it shown.

Thank you.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-16T06:28:07+00:00Added an answer on June 16, 2026 at 6:28 am

    Your toolbar is destroyed at the end of the function as you made it a local variable. Make it a member variable instead.

    Reference:
    How to add control bars to dialog boxes in MFC

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have created a MFC SDI application in Visual Studio 2010 and want to
Created a simple jquery-nivo-like slider using wpf and want to add an animation between
I have created a MFC SDI application, and the view is derived from CFormView,
I created a HTML page with a number of tables with headers like this:
In Single Document Interface (SDI) or Multiple Document Interface (MDI) MFC application, I created
Created a simple navigation controller based application. Application delegate class has Outlets for window
I created an application for android. Now, I want to record a video on
I created a batch to run specific commands, the code looks like this: cd
Created application is working toooo slow, looks like there are a lot of memory
I need to create some dynamic menus in a VS2010 SDI application I'm writing.

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.