RE: creating an alarm clock in mfc

  • From: Jamal Mazrui <empower@xxxxxxxxx>
  • To: programmingblind@xxxxxxxxxxxxx
  • Date: Fri, 26 Oct 2007 17:33:53 -0400 (EDT)

I think the ShowBox variable is getting re-initialized each time the
method is invoked.  Try making it a field rather than local variable.

Jamal
On
Fri, 26 Oct 2007, Andy B wrote:

> Date: Fri, 26 Oct 2007 17:08:27 -0400
> From: Andy B <a_borka@xxxxxxxxxxxxx>
> Reply-To: programmingblind@xxxxxxxxxxxxx
> To: programmingblind@xxxxxxxxxxxxx
> Subject: RE: creating an alarm clock in mfc
>
> I can't use Timer.Stop() because it needs to still keep track of time even
> after the system time reaches the picker time. Here is my original code.
> Just a note and a reminder, the current code listed below pops up a
> MessageBox every second instead of only once when the system time and the
> picker time is the same.
>
> private void Timer_Tick(object Sender, EventArgs e) {
> bool ShowBox=false;
> if((!ShowBox) && (DateTime.Now.CompareTo(Time.Value))) {
> ShowBox=true; //we shouldn't see the box again.
> MessageBox.Show("It's time...");
> }
> }
>
>
>
> -----Original Message-----
> From: programmingblind-bounce@xxxxxxxxxxxxx
> [mailto:programmingblind-bounce@xxxxxxxxxxxxx] On Behalf Of Jamal Mazrui
> Sent: Friday, October 26, 2007 4:50 PM
> To: programmingblind@xxxxxxxxxxxxx
> Subject: RE: creating an alarm clock in mfc
>
>
> Can't you use the Stop method of the timer to prevent the message box from
> repeating?  If not, please repost all relevant code.
>
> Jamal
>
> __________
> View the list's information and change your settings at
> //www.freelists.org/list/programmingblind
>
> __________
> View the list's information and change your settings at
> //www.freelists.org/list/programmingblind
>
__________
View the list's information and change your settings at 
//www.freelists.org/list/programmingblind

Other related posts: