you could use timer, couldn't you ?
any way a threads are very simple, which is a bit more difficult is
understand which function is not thread safe ;-)
(but don't worry in your case)
I will explain you some pseudo code out of my mind (don't have the API
graved in it)
you just need to have a thread which loop for ever, sleeping 15 seconds and
doing a beep.
a thread is initialized with a ThreadStart, a delegate, a method, which it
will call in ..... a separate thread :-)
just an additional things, it's better to make your thread background or
daemon (can't remember which one is .NET terminology) (RTFM)
roughly, in pseudo code, it's like this:
static void Main()
{
Thread t = new Thread(new ThreadStart(DoBeep)); // create
t.Background = true; // make it daemon
t.Start(); /// now it's running in parralel
// the rest of your program
}
static void DoBeep()
{
while(true)
{
Thread.Sleep(15000);
MessageBeep(MB_ICONASTERISK);
}
}
simple as that !
"Keith" <na@na.com> a écrit dans le message de
news:158201c38498$d7bd03d0$a101280a@phx.gbl...
[quoted text, click to view] > I have experience with VBA (o97), but just got my first XP
> box and dotnet, because I need to set up a data collection
> program on an IPaq.
>
> My goal is to have a small data collection program (user
> selects info from radiobuttons, listboxes, etc) but to
> also have the program beep every 15 minutes to signify the
> beginning of a new data collection period. So far, it
> appears that I need to use a thread(?) to accomplish the
> timed beeping.
>
> I've never used threads before, but I think I understand
> them at the highest conceptual level- I (the main thread)
> keep working but I send my assistant out to do some other
> tasks, like watching a stopwatch and hitting me every 15
> minutes to keep me awake. The problem is that the code
> examples (for a non-programmer) are kinda confusing- all
> the samples I've found jump into many lines of code, too
> much for me to pick apart and figure out what the minimum
> code I need to do this would be.
>
> Does anyone have any references to much simplified
> (threads for dummies) snippets?
>
> The overall power consumption of the solution will matter,
> as the device needs to last as long as possible, even
> small gains in total runtime before running down the
> battery could be significant. Not sure if this affects
> what kind of thread solution I should implement.
>
> Many thanks,
> Keith