Little help?

D

Dan

I'm working on a project at the moment, it's an alarm clock (I'm a newbie so
please bare with me).

Basically I've got a timer on my page, the interval is set to 1 second and
it's activated once I set the alarm.

The alarm works if I set it for maybe half an hour, or even an hour. But
I've been testing it overnight and when I wake up my computer has been
rebooting all night.

This continues to happen and the only way to fix it has been to repair
Windows (twice), I'm just wondering if the timer interval is too short, or
if there is a problem with the memory usage?

I have no idea what causes the reboot so any help would be much appreciated,
I've included the code for my timer below!

Thanks :)

Here is the code from my timer.


private void timer1_Tick(object sender, EventArgs e)

{


string TheHour = System.DateTime.Now.Hour.ToString();

string TheMinute = System.DateTime.Now.Minute.ToString();


if (TheHour == textBox1.Text && TheMinute == textBox2.Text)

{

timer1.Stop();

timer1.Enabled = false;

axWindowsMediaPlayer1.URL = listBox1.SelectedItem.ToString();

axWindowsMediaPlayer1.Ctlcontrols.play();

axWindowsMediaPlayer1.settings.setMode("Loop", true);

MessageBox.Show(textBox3.Text);




}

}
 
P

Peter Duniho

Dan said:
I'm working on a project at the moment, it's an alarm clock (I'm a newbie so
please bare with me).

Basically I've got a timer on my page, the interval is set to 1 second and
it's activated once I set the alarm.

The alarm works if I set it for maybe half an hour, or even an hour. But
I've been testing it overnight and when I wake up my computer has been
rebooting all night.

This continues to happen and the only way to fix it has been to repair
Windows (twice), I'm just wondering if the timer interval is too short, or
if there is a problem with the memory usage? [...]

Without a concise-but-complete code example that reliably reproduces the
problem, it's impossible to provide specific advice.

Of the code you posted, the only thing that could even remotely be
involved in your computer rebooting is the ActiveX Windows Media Player
control you are apparently using (based solely on the variable name…you
didn't bother to provide enough code to show us the actual declaration
and initialization). Even that, I'm dubious that it could on its own
cause such a serious problem.

You may want to try using the System.Media.SoundPlayer class instead.
It has much more limited functionality, but if all you're trying to do
is play a sound, it's the way to go.

If that doesn't fix the problem, post a concise-but-complete code
example that reliably reproduces the problem.

Other comments:

– With respect to your hypotheses as to what might be the issue:

• Memory usage: should not cause the computer to reboot, even if
you had a memory consumption problem in your process. Your program
could easily fail, but unless your disk drive is almost full, it should
not affect the whole system

• Timer interval: 1 second is an eternity to a computer. There's
really no interval you could set so short that could cause a problem (at
worst, your timer simply wouldn't get serviced as often as you want),
but for sure if there were one, 1 second would be far longer than the
value that would cause problems.

– There's really no need to check the time every second. Just set
the timer delay so that it fires once in the future at the time you want
it to.

– When you are posting a question, at the very least you should
provide an informative "Subject:" field. Writing "Little help?" is
completely redundant (practically the only threads started here are from
people looking for help), and provides absolutely no insight as to what
the specific problem might be.

Hope that helps.

Pete
 
D

Dan

Thanks for the helpful comments and advice, I do appreciate them.
As I said I'm still learning so I was a bit apprehensive about posting here
about what could be such a simple problem.

I'm going to go and try the System.Media.Soundplayer class like you
suggested and come back and post once I let it run overnight.

In regards to the computer rebooting I noticed a process which was running
and using 99% of the CPU and a lot of memory, the process name was
mscorsvw.exe and when I searched on the internet it was linked to the .NET
framework.

Where I found the following: "mscorsvw.exe is precompiling .NET assemblies
in the background. Once it's done, it will go away."

Now this problem didn't occur until I ran my program, it's a direct result
of my program running. So my other question is there anything major which I
need
to include in my code to fix this? If not I can only assume you're right and
will try and change the media player.

Like I said I didn't mean to be vague with the title, and I appreciate your
help. I'll go and set the System.Media.Soundplayer class and come back with
the results.

Thanks.

Dan.

Peter Duniho said:
Dan said:
I'm working on a project at the moment, it's an alarm clock (I'm a newbie
so please bare with me).

Basically I've got a timer on my page, the interval is set to 1 second
and it's activated once I set the alarm.

The alarm works if I set it for maybe half an hour, or even an hour. But
I've been testing it overnight and when I wake up my computer has been
rebooting all night.

This continues to happen and the only way to fix it has been to repair
Windows (twice), I'm just wondering if the timer interval is too short,
or if there is a problem with the memory usage? [...]

Without a concise-but-complete code example that reliably reproduces the
problem, it's impossible to provide specific advice.

Of the code you posted, the only thing that could even remotely be
involved in your computer rebooting is the ActiveX Windows Media Player
control you are apparently using (based solely on the variable name…you
didn't bother to provide enough code to show us the actual declaration and
initialization). Even that, I'm dubious that it could on its own cause
such a serious problem.

You may want to try using the System.Media.SoundPlayer class instead. It
has much more limited functionality, but if all you're trying to do is
play a sound, it's the way to go.

If that doesn't fix the problem, post a concise-but-complete code example
that reliably reproduces the problem.

Other comments:

– With respect to your hypotheses as to what might be the issue:

• Memory usage: should not cause the computer to reboot, even if you
had a memory consumption problem in your process. Your program could
easily fail, but unless your disk drive is almost full, it should not
affect the whole system

• Timer interval: 1 second is an eternity to a computer. There's
really no interval you could set so short that could cause a problem (at
worst, your timer simply wouldn't get serviced as often as you want), but
for sure if there were one, 1 second would be far longer than the value
that would cause problems.

– There's really no need to check the time every second. Just set the
timer delay so that it fires once in the future at the time you want it
to.

– When you are posting a question, at the very least you should provide
an informative "Subject:" field. Writing "Little help?" is completely
redundant (practically the only threads started here are from people
looking for help), and provides absolutely no insight as to what the
specific problem might be.

Hope that helps.

Pete
 
A

Andrew Poelstra

Thanks for the helpful comments and advice, I do appreciate them.
As I said I'm still learning so I was a bit apprehensive about posting here
about what could be such a simple problem.

Don't worry about it. These threads are archived in many places where
search engines go, and I'm sure you're not the only one with this issue.
Having said that, Usenet etiquette is that you post your reply after
the message (or interspersed, like I'm doing), rather than above it
like you would with email.
I'm going to go and try the System.Media.Soundplayer class like you
suggested and come back and post once I let it run overnight.

In regards to the computer rebooting I noticed a process which was running
and using 99% of the CPU and a lot of memory, the process name was
mscorsvw.exe and when I searched on the internet it was linked to the .NET
framework.

Without knowing much more about your system, I would recommend you
reinstall and/or upgrade your .NET installation (and potentially
your operating system; the Home editions in particular of Windows
seem to fall apart on their own after a year or two).
 
P

Peter Duniho

Dan said:
Thanks for the helpful comments and advice, I do appreciate them.
As I said I'm still learning so I was a bit apprehensive about posting here
about what could be such a simple problem.

I'm going to go and try the System.Media.Soundplayer class like you
suggested and come back and post once I let it run overnight.

Okay. Let's hope that fixes the problem. If it doesn't, it may well be
that you've got some kind of installation error that can be fixed only
be uninstalling and reinstalling. If that's the case, then hopefully
only .NET needs to be reinstalled; there's a small chance your entire OS
is messed up somehow.

Suffice to say, the behavior you describe is abnormal, and a typical
..NET program could not possibly cause it.
In regards to the computer rebooting I noticed a process which was running
and using 99% of the CPU and a lot of memory, the process name was
mscorsvw.exe and when I searched on the internet it was linked to the .NET
framework.

Where I found the following: "mscorsvw.exe is precompiling .NET assemblies
in the background. Once it's done, it will go away." [...]

I don't see why your program should have any particular influence on the
mscorsvw.exe service, nor what that service should cause an issue that
would cause your computer to reboot.

But of course, I know practically nothing about your program, having
seen very little of the code in it. :)

Pete
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top