home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #30 / NN_1992_30.iso / spool / comp / os / mswindo / programm / misc / 4270 < prev    next >
Encoding:
Internet Message Format  |  1992-12-16  |  2.2 KB

  1. Path: 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
  2. From: torstein@itekiris.kjemi.unit.no (torstein hansen)
  3. Newsgroups: comp.os.ms-windows.programmer.misc
  4. Subject: Re: Menu Updating
  5. Message-ID: <TORSTEIN.92Dec16094625@itekiris.kjemi.unit.no>
  6. Date: 16 Dec 92 08:46:25 GMT
  7. References: <2B2E491D.87D9@tct.com>
  8. Sender: news@ugle.unit.no (NetNews Administrator)
  9. Organization: Dept. of Chem.Eng, Norwegian Inst. of Tech
  10. Lines: 55
  11. In-Reply-To: jeff@tct.com's message of Tue, 15 Dec 1992 21:07:41 GMT
  12.  
  13. In article <2B2E491D.87D9@tct.com> jeff@tct.com (Jeff Witzer) writes:
  14.    You know, it seemed like a simple thing to do in theory...
  15.  
  16.    (Famous last words, I know)  All I wanted to do was to display the time in
  17.    the rightmost section of the menu bar.  I already had a 1 second timer to
  18.    keep time for other reasons (with an occasional check of the system clock 
  19.    to keep it reasonably in line) so I thought I'd use ctime to format the
  20.    current time and ModifyMenu () to display it.
  21.  
  22.    The menu item was defined:
  23.  
  24.    .
  25.    .
  26.    .
  27.        MENUITEM "Mon Jan 11 12:00:00", IDM_DATE_TIME, HELP
  28.    .
  29.    .
  30.    .
  31.  
  32.    and the ModifyMenu call went like this:
  33.  
  34.        char szDateTime [30];
  35.  
  36.        sprintf (szDateTime, "%.19s", ctime (&lCurrentTime));
  37.        ModifyMenu (hMainMenu, IDM_DATE_TIME, MF_BYCOMMAND | MF_STRING, 
  38.           IDM_DATE_TIME, szDateTime);
  39.  
  40.    The result?  The initial, dummy date/time (jan 11 12:00:00) is displayed 
  41.    on the very right and stays there.  If I click on it, nothing happens.  If
  42.    I click just to the right of the last real main menu item, the current date/
  43.    time is displayed and doesn't change.  If I keep clicking, I get a "working"
  44.    clock.
  45.  
  46.        1 - Why doesn't the ModifyMenu () place the date/time all the way to the
  47.        right like the initial, dummy date/time?
  48.  
  49.        2 - What do I have to do to actually force display the date/time after
  50.        each ModifyMenu ()?
  51.  
  52.        3 - Is there a better way?
  53.  
  54.    Thanks,
  55.  
  56.    jeff
  57.  
  58.  
  59. Whenever you modify a menu bar, you have to call DrawMenuBar(hWnd) to
  60. make the modifications take effect.
  61.  
  62. Good luck
  63.  
  64. Torstein
  65. --
  66. Torstein Hansen
  67. torstein@itekiris.kjemi.unit.no
  68.