Thread: toolbar in dialog apps

  1. #1
    arun kr sharma
    Guest

    toolbar in dialog apps

    hi i have created a Wizard generated MFC dialog based application and a toolbar resource .

    now when i am adding the toolbar in the initdialog part like with

    CToolBar mytoolbar;

    mytoolbar.CreateEx(this,TBSTYLE_TOOLTIPS |TBSTYLE_FLAT | WS_CHILD | WS_VISIBLE );

    mytoolbar.LoadToolBar(IDR_TOOLBAR);

    I Don't seem to load the toolbar could anyone please tell me where i am wrong


    regards

  2. #2
    Registered User
    Join Date
    Dec 2001
    Posts
    8

    Lightbulb

    Perhaps you should move:

    CToolBar mytoolbar;

    into the header file. Seems to me when initdialog goes out of scope your "CToolBar mytoolbar" would too.

    Also if you are using the Resource Editor to create the dialog box, you should put;

    DDX_Control(pDX, IDC_TOOLBAR, mytoolbar);

    in the DoDataExchange macro.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Replies: 9
    Last Post: 02-13-2008, 02:59 PM
  2. make Child Dialog not Popup?
    By Zeusbwr in forum Windows Programming
    Replies: 5
    Last Post: 04-08-2005, 02:42 PM
  3. MFC :: Dialog ToolBar Won't Show Up ... ?
    By SyntaxBubble in forum Windows Programming
    Replies: 1
    Last Post: 09-05-2003, 05:28 PM
  4. stupid problem in Dialog based Apps by MFC
    By AsAdi in forum Windows Programming
    Replies: 1
    Last Post: 02-06-2003, 01:47 PM
  5. Tab Controls - API
    By -KEN- in forum Windows Programming
    Replies: 7
    Last Post: 06-02-2002, 09:44 AM