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 7943721
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 4, 20262026-06-04T00:21:14+00:00 2026-06-04T00:21:14+00:00

I am writing an MFC Document-View application with tool bars. I want to add

  • 0

I am writing an MFC Document-View application with tool bars. I want to add a tool bar at the top-right corner of the mainframe windoiw. Currently i am using below code to set the tool bar

if (!m_wndToolBar.CreateEx(this, TBSTYLE_FLAT, WS_CHILD | WS_VISIBLE | CBRS_ALIGN_TOP | CBRS_BORDER_RIGHT
    | CBRS_GRIPPER | CBRS_TOOLTIPS | CBRS_FLYBY | CBRS_SIZE_DYNAMIC) ||
    !m_wndToolBar.LoadToolBar(IDR_MAINFRAME))
{
    TRACE0("Failed to create toolbar\n");
    return -1;      // fail to create
}

The above code will create the tollbar at the top left corner of the mainframe. I want to shifted it from left corner to right corner. I want the tool bar to be in top-right corner.

Options is there in MFC to set tool bar in right side,left side,top and bottom. But there is no option to set it at the top-right

Thanks in advance!

  • 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-04T00:21:16+00:00Added an answer on June 4, 2026 at 12:21 am

    As per my knowledge , the only way to do this is by adding dummy buttons in the middle and move the button to the end.

        LPTBBUTTON  newbutton=NULL;
        newbutton=(LPTBBUTTON)calloc(20,sizeof(TBBUTTON));
        int i=0;
    
        for(i=0;i<20;i++)
        {
    
            newbutton[i].iBitmap=-1;// for dummy button
            newbutton[i].idCommand=1222;
            newbutton[i].fsState=TBSTATE_ENABLED;
            newbutton[i].fsStyle=TBSTYLE_BUTTON; //TBSTYLE_SEP;
            newbutton[i].iString=-1;
    
         }
         m_wndToolBar.GetToolBarCtrl().AddButtons(20,newbutton) // this will add 20 new buttons 
         m_wndToolBar.GetToolBarCtrl().MoveButton(1,20);// This will move button from left to right
    

    But the only problem in this model is to adjust the button to handle Maximize option. Need to handle maximize button press and move the button gain to the right.

    If there is any option please let me know. Thanks

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

Sidebar

Related Questions

OK, so we're writing our MFC application to make use of the built-in localization
I'm writing a complex setup/installer application in native C++/MFC. I would very much like
I'm using vc2008, writing some MFC code, I add a button, double click it,
I'm writing a Win32 application using plain C and WinAPI. No MFC or C++
I am writing an MFC application that doesn't use .NET (CLR support is set
I am writing a converter from XML&MathML to MS Word document. I'm using MFC
I am writing a C++/MFC application that will use Microsoft Access to store data.
I am writing an MFC C++ application that has a Save As button for
Writing a dictionary application for android. Want to set translation direction in accord with
I am writing a C++ MFC Dialog based Application and my program has lots

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.