Click here to Skip to main content
16,005,080 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: Header control Pin
try8820-Aug-05 2:02
try8820-Aug-05 2:02 
GeneralRe: Header control Pin
Ali Tavakol20-Aug-05 5:24
Ali Tavakol20-Aug-05 5:24 
GeneralRe: Header control Pin
Jack Puppy20-Aug-05 8:07
Jack Puppy20-Aug-05 8:07 
GeneralRe: Header control Pin
David Crow20-Aug-05 15:59
David Crow20-Aug-05 15:59 
GeneralDialog Title Pin
khlins19-Aug-05 23:15
khlins19-Aug-05 23:15 
GeneralRe: Dialog Title Pin
khan++19-Aug-05 23:41
khan++19-Aug-05 23:41 
GeneralAdding items to menu bar(similar to Add to favourites) Pin
Aditya Rao19-Aug-05 21:47
Aditya Rao19-Aug-05 21:47 
GeneralRe: Adding items to menu bar(similar to Add to favourites) Pin
khan++20-Aug-05 0:20
khan++20-Aug-05 0:20 
To insert a new item:
CMenu* m;<br />
m = AfxGetApp()->GetMainWnd()->GetMenu();<br />
m = m->GetSubMenu(2);//change this to whatever (zero-based index).<br />
m->AppendMenu(MF_ENABLED,253,"new item");//change the second parameter to something you like. and the third one too.


When the menu item is clicked, you need a menu-command-range hander in the message-map macro in the .cpp file:
ON_COMMAND_RANGE(200,400,OnMyMenu)//change the first and second parameter to the range you will provide in the second param to AppendMenu()

The implementation will be:
void CMySdiView::OnMyMenu(UINT nItem)<br />
{<br />
}

Now nItem contains the second parameter you gave in AppendMenu(). So you know which one was clicked.
One thing to note is that you must have at least a sub-item in the menu in the resource. Let it be a separator. When no sub-items are present, it gives a headache.


this is this.
GeneralRe: Adding items to menu bar(similar to Add to favourites) Pin
Tim Zorn21-Aug-05 6:09
Tim Zorn21-Aug-05 6:09 
GeneralUser Define Threads Pin
MURALI RANGANATH19-Aug-05 21:27
MURALI RANGANATH19-Aug-05 21:27 
GeneralRe: User Define Threads Pin
khan++19-Aug-05 21:42
khan++19-Aug-05 21:42 
GeneralDebugging Information Pin
MURALI RANGANATH19-Aug-05 21:18
MURALI RANGANATH19-Aug-05 21:18 
GeneralRe: Debugging Information Pin
Why_am_I_still_Anonymous19-Aug-05 23:12
sussWhy_am_I_still_Anonymous19-Aug-05 23:12 
GeneralHeader control Pin
Ali Tavakol19-Aug-05 21:13
Ali Tavakol19-Aug-05 21:13 
GeneralToolBar Button and Cursor in MFC Pin
suzie10019-Aug-05 16:20
suzie10019-Aug-05 16:20 
GeneralRe: ToolBar Button and Cursor in MFC Pin
khan++19-Aug-05 20:41
khan++19-Aug-05 20:41 
GeneralRe: ToolBar Button and Cursor in MFC Pin
suzie10020-Aug-05 2:10
suzie10020-Aug-05 2:10 
Generalgui problem Pin
meiyueh19-Aug-05 15:52
meiyueh19-Aug-05 15:52 
GeneralRe: gui problem Pin
try8819-Aug-05 17:32
try8819-Aug-05 17:32 
GeneralRe: gui problem Pin
Maximilien20-Aug-05 2:23
Maximilien20-Aug-05 2:23 
GeneralRe: gui problem Pin
John R. Shaw20-Aug-05 2:47
John R. Shaw20-Aug-05 2:47 
GeneralISAPI extension in vc++ Pin
Aditya Rao19-Aug-05 15:14
Aditya Rao19-Aug-05 15:14 
QuestionHow to access Fortran program inside Visual C++? Pin
DawnLee19-Aug-05 14:54
DawnLee19-Aug-05 14:54 
AnswerRe: How to access Fortran program inside Visual C++? Pin
John R. Shaw20-Aug-05 3:24
John R. Shaw20-Aug-05 3:24 
AnswerRe: How to access Fortran program inside Visual C++? Pin
David Crow20-Aug-05 16:02
David Crow20-Aug-05 16:02 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.