Update dynamically appended MDI menu

I am trying to dynamically append a menu to MDI Doc/View's menu.
Everything is ok except that the menu doesn't get refreshed till I
move/minimize (etc.) the main App's window. Kindly suggest as to how to
make it visible as soon as the child window gets visible.
Seems AfxGetApp()->m_pMainWnd->UpdateWindow();  isn't working either
:o(



CMenu *pMainMenu = AfxGetApp()->m_pMainWnd->GetMenu();

// Assuming that we have a qualified CMenu object pointer
// called 'pChildMenu', let's append it to the main menu:
pMainMenu->AppendMenu(MF_STRING|MF_POPUP , (int)pChildMenu->m_hMenu,
"Options");

// Update the app's main window:
AfxGetApp()->m_pMainWnd->UpdateWindow(); // this DOESN'T seem to work!


warm regards,
D. Rathore
(remove all underscores for email ID)

0
1/3/2006 12:48:16 AM
vc.mfc 33608 articles. 0 followers. Follow

3 Replies
1112 Views

Similar Articles

[PageSpeed] 17

From http://support.microsoft.com/kb/q145857/

You must call CFrameWnd::OnUpdateFrameMenu(NULL) or
CMDIFrameWnd::OnUpdateFrameMenu(NULL) in order to set the new menu into the
window. Call DrawMenuBar() to redraw the menu.



"divya_rathore_@gmail.com" <divyarathore@gmail.com> ????
news:1136249296.396604.51380@g14g2000cwa.googlegroups.com...
> I am trying to dynamically append a menu to MDI Doc/View's menu.
> Everything is ok except that the menu doesn't get refreshed till I
> move/minimize (etc.) the main App's window. Kindly suggest as to how to
> make it visible as soon as the child window gets visible.
> Seems AfxGetApp()->m_pMainWnd->UpdateWindow();  isn't working either
> :o(
>
>
>
> CMenu *pMainMenu = AfxGetApp()->m_pMainWnd->GetMenu();
>
> // Assuming that we have a qualified CMenu object pointer
> // called 'pChildMenu', let's append it to the main menu:
> pMainMenu->AppendMenu(MF_STRING|MF_POPUP , (int)pChildMenu->m_hMenu,
> "Options");
>
> // Update the app's main window:
> AfxGetApp()->m_pMainWnd->UpdateWindow(); // this DOESN'T seem to work!
>
>
> warm regards,
> D. Rathore
> (remove all underscores for email ID)
>


0
sheng_jiang (305)
1/3/2006 1:48:03 AM
excellent!
Thanks a lot :o)

D. Rathore

0
1/3/2006 2:11:19 AM
Another easy way to switch menus, say you have two, a main and an alternate, 
is to declare two CMenu objects in your CMainFrame class definition:

CMenu  m_mainMenu;
CMenu  m_altMenu;
void OnSwitchMenus();

then, in CMainFrame's constructor:
m_mainMenu.Attach(GetMenu()->m_hMenu); // this goes after main menu has 
already been loaded into the mainframe, I.E, after the call to create()
m_altMenu.LoadMenu(_IDR_ALTMENU);

Then, in CMainFrame, implement OnSwitchMenu like this:
void CMainFrame::OnSwitchMenus()
{
     if(GetMenu()->m_hMenu == m_mainMenu.m_hMenu) // main menu is up
            SetMenu(&m_altMenu); // switch to alternate.
    else // alternate is up
            SetMenu(&m_mainMenu);
}

You can play on this implementation, but the main thing I wanted to point 
out is how you can use SetMenu to immediately replace the current menu.

Ed


CMenu m_mainMenu;

CMenu m_altMenu;

"divya_rathore_@gmail.com" <divyarathore@gmail.com> wrote in message 
news:1136254279.061772.276510@g49g2000cwa.googlegroups.com...
> excellent!
> Thanks a lot :o)
>
> D. Rathore
> 


0
1/3/2006 6:41:49 AM
Reply:

Similar Artilces:

Lost Menu Bar.
Hi there, I have lost my wooksheet menu bar in EXCEL. Even after reinstializing MS office it does not appear. Any idea how to restore it back. rgds Mdalvi. H Mdalvi! Use: ALT + F11 to open visual basic editor. View>Immediate Window. With the cursor in the Immediate Window type: Application.CommandBars(1).Reset Press Enter ALT + F11 to go back to Excel to see if the Worksheet Menu Bar is visible. -- Regards Norman Harker MVP (Excel) Sydney, Australia njharker@optusnet.com.au Excel and Word Function Lists (Classifications, Syntax and Arguments) available free to good homes. &qu...

National City auto-update
I used to be able to have Microsfot Money automatically download transactions from my accounts. Now whenever it goes to check it says it failed. I tried setting it up again but it prompts me "National City Requires a Password Change", but no matter what I enter in these boxes it says the password/pin is incorrect. I called National City and they said there wasn't anything wrong with my account. What should I do? In microsoft.public.money, Josh wrote: >I used to be able to have Microsfot Money automatically download transactions >from my accounts. Now whenever i...

money 2007 crashes when updating account info
Hi folks, I'm running Money 2007 trial on vista. However after I fill in my email/password, Money pops out a window saying "Updating Accout Info", then it crashes! If I restart the program I can login, but retrieving bank list failes each time and money crashes when I click "receive account updates from MSN money my accounts". I've owned money 2006 before so I think I do have some old information on msn money.Any idea? Thanks Kun In microsoft.public.money, qk wrote: > >I'm running Money 2007 trial on vista. However after I fill in my >email/...

Updating 20k+ rows from Excel to access. vbscript? VBA? SQL?
Any suggestions? Some of these rows only need a few columns updated, and others need all of them updated. If possible if say row 800 column 'S' is filled in the access DB but is blank on the excel spreadsheet, if possible i like to keep the existing data in access and over right it with a blank cell. The spreadsheet is a export of the access DB, changes were made/merged from other spreadsheets so the Unique ID is the same and in column A. A script suggestions to complete this? Thanks :) dim dbe dim db dim ssql set dbe = createobj("dao.dbengine.36") set db = dbe.openda...

SQL to update Item.LastCounted based on PhysicalInventory.CloseTime
Because of a bug/deficiency/oversight in a third party inventory counting application , I did a bunch of physical inventories that did not update the Item.LastCounted field. I need this field updated so I can see the correct date each item was counted last. I am willing to do a seperate SQL statement for each physical inventory sheet for which I have the problem. For example, I want to take each item in the PhysicalInventoryEntry table with PhysicalInventory.Code = '0000057' (or whatever the code is) and set Item.LastCounted = PhysicalInventory.CloseTime. I am not great at SQ...

Historical Stock Status As of Date
This is a multi-part message in MIME format. ------=_NextPart_000_00A5_01C8845C.ADFC9B50 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable Hello, I'd like to know whether anyone has encountered an issue wherein the As = of Date that is printed in the Historical Stock Status Detailed by Item = does not follow the date as indicated in the report options screen. = Currently we are trying to print the said report but no matter what date = we put in, the As of Date that prints on the report is set to 30 Jan = 2008. Is there anything that we...

No sound after updating SP2 for Vista
Hi,sorry if this is a duplicate post,but I'm not sure mine posted the first time,it's not coming up in my searches. My Dell Inspiron 1420 laptop automatically informed me of an important update last night,and I went ahead and clicked through it and restarted.It had me download the SP2 for Vista and install it,but when I turned my computer back on after the requisite restart,my computer wasn't making any sound whatsoever.I tried using the volume toggle on the taskbar,I tried pressing the volume and mute buttons on my laptop and playing with the volume sliders in eac...

Todays Date that does not update
I created a macro and a button that when clicked it entered todays date in a cell, which is what I wanted. I used "Today( )". Problem is the date keeps updating to todays date and I want it to stay the date I entered it in. Is there some other value or formula to do this so it does not update everyday? Thanks!! You need to enter the date itself. Any function will always update to the current date. Ctrl+; will enter the current date in a cell. In VBA, use Range("A1").Value = Date -- Cordially, Chip Pearson Microsoft MVP - Excel Pearson Software Consulting, LLC...

Merge & Sort Dynamic Lists w/ Data Validation
First off, let me say thanks to the Excel Usenet community that has helped me over and over through these newsgroups. You are phenomenal. Question 1: I need to create a BOTH box that will dynamically pull names from both the "Chicago Office" & "Seattle Office" columns in my sheet. It is extremely preferable to do this without VB Script if possible to avoid the security warnings on opening the sheet. (Our IT department will not budge on this..) Detail: I have two lists of employees. Column A lists the Chicago Office employees. Column B lists the Seattle Office employee...

Can't get automatic updates to work
I get this message: [Error number: 0x8DDD0018] The site cannot continue because one or more of these Windows services is not running: Automatic Updates (allows the site to find, download and install high-priority updates for your computer) Background Intelligent Transfer Service (BITS) (helps updates download more quickly and without problems if the download process is interrupted) Event Log (keeps a record of updating activities to help with troubleshooting, if needed) To make sure these services are running: 1. Click Start, and then click Run. 2. Type servic...

money2004 hanging on updates
I upgraded from money2003 to money2004 last night, then went to online updates. The program can download my bank transactions but when it gets to "updating securities and news" it hangs. I cancel, and it hangs on "cancelling call". I end up having to cont-alt-del and restart money. Happens every time. Any suggestions or is it a server problem? thanks in advance In microsoft.public.money, jeff wrote: >I upgraded from money2003 to money2004 last night, then >went to online updates. The program can download my bank >transactions but when it gets to &q...

Update Query
I have 2 tables: Member and Bulk Mail I have linked them on Last Name Member has these fields: First Name, Last Name, E-mail Bulk mail has these fields: First Name, Last Name, e-mail address The member table has no data in the E-mail field The Bulk Mail table has data in the e-mail address field I would like to update the Member E-mail field with the data in the Bulk Mail e-mail address field using the Query Wizard Glenn Glenn T. Dulmage 207 Valley Road Chestertown, MD 21620 410-778-5166 gdulmage@verizon.net Glenn So, you quite certain that you don't have and ...

Restriction on appending data to custom fields on Account Form?
I'm having problems appending data to a custom field on the Account Form. However, the code works perfectly on a custom form, I've made. Btw, the ONLOAD code is: crmForm.all.fieldname.DataValue = 'Text'; On the custom form, the field is filled with the word Text, but on the Account form, nothing happens. Is there some kind of restriction on the account form, and if so - is it possible to remove this restriction? Thanks btw, another example to illustrate the problem: I use this code... window.moveTo(0,0); window.resizeTo(screen.availWidth, screen.availHeight); ....to...

Outlook 2003 Cached Mode
When using Outlook 2003 in cached mode with Exchange, changes to the Outlook Address Book are not updated. If a user is added, removed, or changed in the address book, that change is not reflected in the Outlook 2003 client. Doing a manual Send/Receive/Download Address Book/Full Details does not work. The only thing I have found that works is to remove all the *.OAB files from the user profile. ...

Dynamic Summing
I have a workbook, where the data is arranged with headings in the first row and data every other. New columns are added to the worksheet every month (2 in fact). A summary worksheet sums the data by row, but only for the last row of the data-worksheet. IE If the last column is X, then the summary worksheet will sum X2:X10. Next month, the new data will be in Z, thus I need the summary worksheet to sum Z2:Z10. Here are my criteria: * The number of rows to be summed is dependant on the number of items in column A * Column A contains blank cells * The number of columns in the data-worksheet wil...

Much adieu about updating and such
OK, I'll be as brief and succinct as I can here. I came to the group to see what I could learn about problems with updating data with the older versions of Money. I started running Money 2001 Deluxe hot of the press back in 2001. I obtained a new desktop in 2003 that had Money 2002 installed by the manufacturer, so I just transferred my files using a floppy (in those days - can you imagine?) and started working with 2002. Didn't care for some of the changes, but...not earth-shattering stuff so I just went with it. Recently I started using a 5-year-old IMB laptop with no Money on...

Upgrade from Money98 to Money 2004 fail to update the old accountfile
When upgrading from Money98 to Money2004 I Money2004 fails to update all data from Mone98. It says incompatible file version. Any idea how I get my data from Money98 converted to Money2004 ? The FAQ to beat all FAQs. See http://www.bollar.org/msmoney/#Q1. "Per" <toppeja@hotmail.com> wrote in message news:05d301c3b39c$25befed0$a301280a@phx.gbl... > When upgrading from Money98 to Money2004 I Money2004 > fails to update all data from Mone98. It says > incompatible file version. Any idea how I get my data > from Money98 converted to Money2004 ? ...

Automatically update cells
Hi all, I am looking for help with the following problem. I would like for two cells to automatically update every time I fill in other cells. For example: Cell A1 is the date cell Cell B1 is the weight cell In column F, I have every date for a month and in column G, I insert a weight I would like for cell A1 to automatically update with the date from column F and cell B1 to automatically update with the weight every time I enter a weight into column G. For example: If column F has every date for a particular month, i.e. 1/3/06 in cell F1 and I enter 50.0 in cell G1, then cell A1 ...

Use that security update
--mkiwhwpnjcjb Content-Type: multipart/related; boundary="sxwxczsxhcxkocu"; type="multipart/alternative" --sxwxczsxhcxkocu Content-Type: multipart/alternative; boundary="nmfgoiam" --nmfgoiam Content-Type: text/plain Content-Transfer-Encoding: quoted-printable Microsoft User this is the latest version of security update, the "October 2003, Cumulative Patch" update which resolves all known security vulnerabilities affecting MS Internet Explorer, MS Outlook and MS Outlook Express as well as three new vulnerabilities. Install now to maintain the securit...

annoying updating time!
I am relativley new to Excel forumlas so im hoping this is a simple problem I was a simple spreadsheet that will enter the current time into a cell when a value is put in. the formula I have is: =IF(B3>1,NOW(),"") this gives me the current time if there is a value greater than one in there - PERFECT...except... it updates everytime i enter something. I need the date to stay where it is if i make changes to other cells. :eek: I looked through the web and am having trouble thanks in advance for the help Alex -- AJSullivan -----------------------------------------------...

ughh.... Office 2004 sp2 (11.2) update error
Let me start this out by saying I'm a PC engineer, I do not do Macs, but my wife had a G4 and we just upgraded it. I know I'm not the only one getting this error as I've seen it listed about a dozen times, but the only people that I see with a solution have external hard drives. I've loaded Office 2004 with SP2 Version 11.2 (050714). I've tried auto update as well as downloading. and I keep getting the #$%#@ error "The installer could not locate the correct version of the software required to install this update. See the Read Me file included with this install to det...

Speed of dynamic vs "normal" Excel report
When I run the same advanced find from the CRM application versus from a dynmic Excel I and many of our users experience significant differnce in time it actually takes to get the data. (Were are talking 3 minutes vs. 30 minutes!) Any idea on why this signigificant difference and what to do about it? On Jul 4, 8:08=A0pm, Jan Pola <JanP...@discussions.microsoft.com> wrote: > When I run the same advanced find from the CRM application versus from a > dynmic Excel I and many of our users experience significant differnce in = time > it actually takes to get the data. (Were are t...

Updating Charts in Excel
How do you update the chart in excel if the source data has been changed. Linked charts update data automaticaly >-----Original Message----- >How do you update the chart in excel if the source data >has been changed. >. > >-----Original Message----- >How do you update the chart in excel if the source data >has been changed. >. >Yes the updates are posted to excel which points to the database ...

"Help Menu" does not close
How do I close the "Help Menu"? I notice on both Entourage Help and Word Help, that there is no close or hide button. The Help Menu just rides on top of the program until I quit the entire program. I can make the window really small by dragging the corner, but it still sits on top of the main program. I know I have to be missing something simple here, but I have been looking at this for 3 days and do not know how to get rid of it. Thank you, Michael Tall Entourage and Word Help do have a close and maximize button (the minimize button is greyed out). You probably don't noti...

Bill Calendar update problem
I have my bills setup to remind me at a months glance when they are due. (not billpay) But when I auto update my accounts (eg..checking) and it see's a transaction from my bank that is close to the date, and amount of a bill...it automatically assumes this is a bill and enters it as such in the account register. I want to manually enter in Bills. This seems to happen mostly with Cash withdrawls, than anything else. Any help would be appreciated. -JW ...