Codejock Forums Homepage
Forum Home Forum Home > Codejock Products > Visual C++ MFC > Command Bars
  New Posts New Posts RSS Feed - menu add dynamically and mouse hooking
  FAQ FAQ  Forum Search   Events   Register Register  Login Login

menu add dynamically and mouse hooking

 Post Reply Post Reply
Author
Message
suchout View Drop Down
Groupie
Groupie


Joined: 29 September 2009
Status: Offline
Points: 13
Post Options Post Options   Thanks (0) Thanks(0)   Quote suchout Quote  Post ReplyReply Direct Link To This Post Topic: menu add dynamically and mouse hooking
    Posted: 06 October 2009 at 9:40pm

Hello everybody!

First, I'd like to beg your pardon that I'm quite poor in English.

 
I developed a MDI application which  make new User-Interface by call DLL.
 
First, I called DLL with MainFrame's variable pCommandBars as an argument
---OK---
and .. in Dll , i initialized MenuBar and Toolbar  so simple 
---OK---
and .. UI Construction Button Clicked -> MenuBar , ToolBar Controls Clean up.
Question 1. How to Delete Menu Bar, ToolBar!
i try this.
--------------------------------------------------------------------------------------------------
nCount = pCommandBars->GetCount();
 
 for (int j = 1; j < nCount; j++) {
    m_pToolBar = pCommandBars->GetAt(j);
    nCount2 = m_pToolBar->GetControlCount();
    for (i = 0; i < nCount2; i++) {  
       m_pToolBar->GetControls()->Remove(0);
    }  
 }
 --------------------------------------------------------------------------------------------------
but this way Not Deleted Toolbar all  but  deleted all of Toolbar's item
 
i want to delete ToolBar (Commandbar) All
 
and make some of User want count of Toolbar
 
but!!!!!!!
BuT!!!!!
In dll project , can not use this!
--------------------------------------------------------------------------------------------------
for (i = 1; i < pMainCommandBars->GetCount();i++) {  //i == 0 -> menubar,
  m_pToolBar = pMainCommandBars->GetAt(i);    
  pMainCommandBars->Remove(pMainCommandBars->GetAt(i));      // M== Error!!
}
--------------------------------------------------------------------------------------------------
and .. i use XML Document   for get controls property (ex. Menu(item) - name , ID,    Toolbar(button) -  icon ID, ....) 
---OK---
and .. re-construct MenuBar, ToolBar
but!!!!!!!
BuT!!!!!
In dll project , can not use this!
--------------------------------------------------------------------------------------------------
CXTPToolBar* pToolBar = (CXTPToolBar*)pCommandBars->Add(_T("Standard"), xtpBarTop);   // <== make error
 if (!pToolBar || !pToolBar->LoadToolBar(IDR_MAINFRAME))
 {
     TRACE0("Failed to create toolbar\n");
     return -1;
 }
-------------------------------------------------------------------------------------------------- 
 
and .. skip error(using '/* , */' ^^;;;;) ,  i construct menu.
-------------------------------------------------------------------------------------------------- 
m_Menu.CreateMenu();
..initmenu()...
m_pMenuBar->GetControls()->LoadMenuW(&m_Menu);
-------------------------------------------------------------------------------------------------- 
 
but.!
BUT!!!
Execute Program!, i put mouse curser on the menu item 
 
Boom~~~
 
so i think that why? but...i don't know that....ㅠㅠ
 
please help me
 
 
Back to Top
 Post Reply Post Reply
  Share Topic   

Forum Jump Forum Permissions View Drop Down

Forum Software by Web Wiz Forums® version 12.04
Copyright ©2001-2021 Web Wiz Ltd.

This page was generated in 0.141 seconds.