using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using System.Diagnostics;
using System.Runtime.InteropServices;
using System.Media;
namespace AlamTest
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
[DllImport("kernel32.dll")]
public static extern bool Beep(int n, int m);
private void button1_Click(object sender, EventArgs e)
{
DateTime dteToday = DateTime.Parse(textBox3.Text); //값입력받기
DateTime dteToday1 = DateTime.Now; //오늘날짜
TimeSpan dte2 = dteToday1 - dteToday; //오늘 - 입력받은날
textBox2.Text = dte2.ToString(); //결과 출력
}
private void tmrClock_Tick(object sender, EventArgs e)
{
label5.Text = DateTime.Now.ToShortDateString(); //오늘날짜
label6.Text = DateTime.Now.ToLongTimeString(); //오늘시간
}
private void timer1_Tick(object sender, EventArgs e)
{
DateTime aa = DateTime.Parse(textBox3.Text); //값입력받기.
if (aa.ToString() == DateTime.Now.ToString())
{
SoundPlayer player = new SoundPlayer(@"C:\Windows\Media\tada.wav"); //소리 재생
player.PlaySync();
}
}
}
}