Article View: comp.os.ms-windows.programmer.misc
Article #1876Re: Menu Updating
From: torstein hansen
Date: Wed, 16 Dec 1992 08:46
Date: Wed, 16 Dec 1992 08:46
55 lines
2293 bytes
2293 bytes
In article <2B2E491D.87D9@tct.com> jeff@tct.com (Jeff Witzer) writes:
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
Whenever you modify a menu bar, you have to call DrawMenuBar(hWnd) to
make the modifications take effect.
Good luck
Torstein
--
Torstein Hansen
torstein@itekiris.kjemi.unit.no
Technical Details
Message-ID:
<TORSTEIN.92Dec16094625@itekiris.kjemi.unit.no>Path:
arc1-ca.pugleaf.net!sparky!uunet!spool.mu.edu!sdd.hp.com!usc!enterpoop.mit.edu!eru.mt.luth.se!lunic!sunic!aun.uninett.no!ugle.unit.no!ugle.unit.no!torsteinReferences:
<2B2E491D.87D9@tct.com>Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!sparky!uunet!spool.mu.edu!sdd.hp.com!usc!enterpoop.mit.edu!eru.mt.luth.se!lunic!sunic!aun.uninett.no!ugle.unit.no!ugle.unit.no!torstein From: torstein@itekiris.kjemi.unit.no (torstein hansen) Newsgroups: comp.os.ms-windows.programmer.misc Subject: Re: Menu Updating Message-ID: <TORSTEIN.92Dec16094625@itekiris.kjemi.unit.no> Date: 16 Dec 92 08:46:25 GMT References: <2B2E491D.87D9@tct.com> Sender: news@ugle.unit.no (NetNews Administrator) Organization: Dept. of Chem.Eng, Norwegian Inst. of Tech Lines: 55 In-Reply-To: jeff@tct.com's message of Tue, 15 Dec 1992 21:07:41 GMT