Article View: comp.os.ms-windows.programmer.misc
Article #1849Menu Updating
From: Jeff Witzer
Date: Tue, 15 Dec 1992 21:07
Date: Tue, 15 Dec 1992 21:07
43 lines
1686 bytes
1686 bytes
You know, it seemed like a simple thing to do in theory...
(Famous last words, I know) All I wanted to do was to display the time in
the rightmost section of the menu bar. I already had a 1 second timer to
keep time for other reasons (with an occasional check of the system clock
to keep it reasonably in line) so I thought I'd use ctime to format the
current time and ModifyMenu () to display it.
The menu item was defined:
.
.
.
MENUITEM "Mon Jan 11 12:00:00", IDM_DATE_TIME, HELP
.
.
.
and the ModifyMenu call went like this:
char szDateTime [30];
sprintf (szDateTime, "%.19s", ctime (&lCurrentTime));
ModifyMenu (hMainMenu, IDM_DATE_TIME, MF_BYCOMMAND | MF_STRING,
IDM_DATE_TIME, szDateTime);
The result? The initial, dummy date/time (jan 11 12:00:00) is displayed
on the very right and stays there. If I click on it, nothing happens. If
I click just to the right of the last real main menu item, the current date/
time is displayed and doesn't change. If I keep clicking, I get a "working"
clock.
1 - Why doesn't the ModifyMenu () place the date/time all the way to the
right like the initial, dummy date/time?
2 - What do I have to do to actually force display the date/time after
each ModifyMenu ()?
3 - Is there a better way?
Thanks,
jeff
Technical Details
Message-ID:
<2B2E491D.87D9@tct.com>Path:
arc1-ca.pugleaf.net!sparky!uunet!sybus.sybus.com!myrddin!tct!jeffShow Full Headers
Complete Article Headers
Newsgroups: comp.os.ms-windows.programmer.misc Path: arc1-ca.pugleaf.net!sparky!uunet!sybus.sybus.com!myrddin!tct!jeff From: jeff@tct.com (Jeff Witzer) Subject: Menu Updating Message-ID: <2B2E491D.87D9@tct.com> Date: Tue, 15 Dec 1992 21:07:41 GMT Organization: TC Telemanagement, Clearwater, FL Lines: 43