VS2005有段QQ系统消息代码,声音控制问题,请教各位大侠
王少雷 2010-08-25 01:44:34 //得到系统消息,并且闪烁
private void tmrSystem_Tick(object sender, EventArgs e)
{
//正常闪烁
sbFriends.Invalidate();
int num = 0;
try
{
DBHelper.con.Open();
string sql = string.Format("select count(fromuserid) from messages where touserid={0} and messagetypeid=2 and messagestate=0", int.Parse(UserHelper.name));
SqlCommand cmd = new SqlCommand(sql, DBHelper.con);
num = Convert.ToInt32(cmd.ExecuteScalar());
}
catch (Exception)
{
throw;
}
finally
{
DBHelper.con.Close();
}
if (num > 0)
{
if (this.toolBugle.Visible==true)
{
this.toolBugle.Visible = false;
}
else if (this.toolBugle.Visible == false)
{
this.toolBugle.Visible = true;
}
SoundPlayer player = new SoundPlayer("system.wav");
player.Play();
}
else
{
this.toolBugle.Visible = true;
}
}
这样的话,我的时钟一直在扫描数据库,声音就一直在响,有大侠能控制声音时间吗。
请教