ALLInterview.com :: Home Page KalAajKal.com
 Advertise your Business Here     
Browse  |   Placement Papers  |   Company  |   Code Snippets  |   Certifications  |   Visa Questions
Post Question  |   Post Answer  |   My Panel  |   Search  |   Articles  |   Topics  |   ERRORS new
   Refer this Site  Refer This Site to Your Friends  Site Map  Bookmark this Site  Set it as your HomePage  Contact Us     Login  |  Sign Up                      
tip   To Refer this Site to Your Friends   Click Here
Google
 
Categories  >>  Software  >>  Programming Languages  >>  VC++  >>  MFC
 
 


 

 
 MFC interview questions  MFC Interview Questions
 ATL interview questions  ATL Interview Questions
 COM DCOM interview questions  COM DCOM Interview Questions
 Win32API interview questions  Win32API Interview Questions
 ActiveX interview questions  ActiveX Interview Questions
 VC++ AllOther interview questions  VC++ AllOther Interview Questions
Question
How can i implement the dynamic menus in MFC plz give the 
code
 Question Submitted By :: K.ramaswamy
I also faced this Question!!     Rank Answer Posted By  
 
  Re: How can i implement the dynamic menus in MFC plz give the code
Answer
# 1
Create a CMenu object on the stack frame as a local, then 
call CMenu’s member functions to manipulate the new menu as 
needed. Use the following function to create the same
1. LoadMenu,SetMenu or TrackPopupMenu function
 
Is This Answer Correct ?    1 Yes 0 No
Surendra Mishra
 
  Re: How can i implement the dynamic menus in MFC plz give the code
Answer
# 2
The code would look like this:

BEGIN_MESSAGE_MAP(CSomeCtrl, COleControl)
  //{{AFX_MSG_MAP(CSomeCtrl)
  //}}AFX_MSG_MAP
  ON_COMMAND(IDM_MENU_ITEM, OnPopupMenuItem)
END_MESSAGE_MAP()

LRESULT CSomeCtrl::OnPopupMenuItem(WORD wNotifyCode, WORD
wID, HWND hWndCtl, BOOL& bHandled)
{
  // Implementation of the menu command handler...
  return S_OK;
}


{
  // Dynamic creation...
  CMenu mnuZoomOutPopUp;
  mnuZoomOutPopUp.CreatePopupMenu();

  CString strMenuItem;
  strMenuItem.LoadString(IDM_MENU_ITEM);
  mnuZoomOutPopUp.AppendMenu( MF_STRING | MF_ENABLED,
IDM_MENU_ITEM, strMenuItem );
  mnuZoomOutPopUp.AppendMenu( MF_SEPARATOR, 0, "" );
  // nLeftPos, nTopPos -- screen coordinates of pop-up menu
placement ...
  mnuZoomOutPopUp.TrackPopupMenu( TPM_LEFTALIGN, nLeftPos,
nTopPos, this );
  mnuZoomOutPopUp.DestroyMenu();
}
 
Is This Answer Correct ?    0 Yes 0 No
Igor Polivanyi
 
 
 

 
 
 
Other MFC Interview Questions
 
  Question Asked @ Answers
 
how many types of messages are their E-Logic4
if i modified data in 1 view how does the other view knows Siemens1
What is Multithreading Invensys1
How to handle RTTI in MFC ?  1
what is the updated verssion in vc++ Aspect1
what is the use of Mutex and critical section  2
what is the size of a process E-Logic2
What is CALLBACK? How it work? what is the advantage of CALLBACK, please explain with an example  1
is there any class which is not derived from Cobject Patni8
What MFC base classes provide support for ActiveX controls? Wipro2
if no message handler is available for a message then will deal with the message ? does window proving any default mechanism? Patni2
how many types of classes are ther,what are that L&T3
How to setup a timer?  2
What is a critical section and how is it implemented?  1
How can i change the color of a dropdowncombobox elements  1
What is the difference between the ASSERT and VERIFY macros?  3
What is CArchive class dowes?  3
Explain StretchBlt and BitBlt  1
How to access document object from view ?  1
Psychic Window Technique E-Logic1
 
For more MFC Interview Questions Click Here 
 
 
 
 
 
   
Copyright Policy  |  Terms of Service  |  Help  |  Site Map 1  |  Articles  |  Site Map  |   Site Map  |  Contact Us interview questions urls   External Links 
   
Copyright © 2007  ALLInterview.com.  All Rights Reserved.

ALLInterview.com   ::  Forum9.com   ::  KalAajKal.com