home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #30 / NN_1992_30.iso / spool / comp / os / mswindo / programm / misc / 4257 < prev    next >
Encoding:
Text File  |  1992-12-15  |  1.6 KB  |  53 lines

  1. Newsgroups: comp.os.ms-windows.programmer.misc
  2. Path: sparky!uunet!sybus.sybus.com!myrddin!tct!jeff
  3. From: jeff@tct.com (Jeff Witzer)
  4. Subject: Menu Updating
  5. Message-ID: <2B2E491D.87D9@tct.com>
  6. Date: Tue, 15 Dec 1992 21:07:41 GMT
  7. Organization: TC Telemanagement, Clearwater, FL
  8. Lines: 43
  9.  
  10. You know, it seemed like a simple thing to do in theory...
  11.  
  12. (Famous last words, I know)  All I wanted to do was to display the time in
  13. the rightmost section of the menu bar.  I already had a 1 second timer to
  14. keep time for other reasons (with an occasional check of the system clock 
  15. to keep it reasonably in line) so I thought I'd use ctime to format the
  16. current time and ModifyMenu () to display it.
  17.  
  18. The menu item was defined:
  19.  
  20. .
  21. .
  22. .
  23.     MENUITEM "Mon Jan 11 12:00:00", IDM_DATE_TIME, HELP
  24. .
  25. .
  26. .
  27.  
  28. and the ModifyMenu call went like this:
  29.  
  30.     char szDateTime [30];
  31.                           
  32.     sprintf (szDateTime, "%.19s", ctime (&lCurrentTime));
  33.     ModifyMenu (hMainMenu, IDM_DATE_TIME, MF_BYCOMMAND | MF_STRING, 
  34.                IDM_DATE_TIME, szDateTime);
  35.     
  36. The result?  The initial, dummy date/time (jan 11 12:00:00) is displayed 
  37. on the very right and stays there.  If I click on it, nothing happens.  If
  38. I click just to the right of the last real main menu item, the current date/
  39. time is displayed and doesn't change.  If I keep clicking, I get a "working"
  40. clock.
  41.  
  42.     1 - Why doesn't the ModifyMenu () place the date/time all the way to the
  43.         right like the initial, dummy date/time?
  44.     
  45.     2 - What do I have to do to actually force display the date/time after
  46.         each ModifyMenu ()?
  47.     
  48.     3 - Is there a better way?
  49.     
  50. Thanks,
  51.  
  52. jeff
  53.